vi keys from Will Maier.

This commit is contained in:
Nicholas Marriott 2008-06-04 18:50:35 +00:00
parent 04c60283c4
commit 39be570b20
6 changed files with 32 additions and 12 deletions

1
TODO
View File

@ -81,3 +81,4 @@
- show-options - show-options
- let server die when last session does - let server die when last session does
- each command should have a print op as well for list keys - each command should have a print op as well for list keys
- fix occasion start server problems

View File

@ -1,4 +1,4 @@
/* $Id: input.c,v 1.47 2008-06-04 16:46:23 nicm Exp $ */ /* $Id: input.c,v 1.48 2008-06-04 18:50:34 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -223,8 +223,6 @@ input_parse(struct window *w)
else else
screen_write_start(&ictx->ctx, &w->base, NULL, NULL); screen_write_start(&ictx->ctx, &w->base, NULL, NULL);
if (ictx->off != ictx->len)
w->flags |= WINDOW_ACTIVITY;
while (ictx->off < ictx->len) { while (ictx->off < ictx->len) {
ch = ictx->buf[ictx->off++]; ch = ictx->buf[ictx->off++];
ictx->state(ch, ictx); ictx->state(ch, ictx);
@ -483,7 +481,8 @@ input_handle_character(u_char ch, struct input_ctx *ictx)
{ {
log_debug2("-- ch %zu: %hhu (%c)", ictx->off, ch, ch); log_debug2("-- ch %zu: %hhu (%c)", ictx->off, ch, ch);
screen_write_put_character(&ictx->ctx, ch); if (screen_write_put_character(&ictx->ctx, ch))
ictx->w->flags |= WINDOW_ACTIVITY;
} }
void void

View File

@ -1,4 +1,4 @@
/* $Id: screen-display.c,v 1.14 2007-12-06 22:13:14 nicm Exp $ */ /* $Id: screen-display.c,v 1.15 2008-06-04 18:50:34 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -22,6 +22,14 @@
#include "tmux.h" #include "tmux.h"
/* Get a cell. */
void
screen_display_get_cell(struct screen *s,
u_int px, u_int py, u_char *data, u_char *attr, u_char *colr)
{
screen_get_cell(s, screen_x(s, px), screen_y(s, py), data, attr, colr);
}
/* Set a cell. */ /* Set a cell. */
void void
screen_display_set_cell( screen_display_set_cell(

View File

@ -1,4 +1,4 @@
/* $Id: screen-write.c,v 1.5 2007-12-06 19:57:01 nicm Exp $ */ /* $Id: screen-write.c,v 1.6 2008-06-04 18:50:34 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -98,10 +98,12 @@ screen_write_set_title(struct screen_write_ctx *ctx, char *title)
} }
/* Put a character. */ /* Put a character. */
void int
screen_write_put_character(struct screen_write_ctx *ctx, u_char ch) screen_write_put_character(struct screen_write_ctx *ctx, u_char ch)
{ {
struct screen *s = ctx->s; struct screen *s = ctx->s;
u_char data, attr, colr;
int n;
if (s->cx == screen_size_x(s)) { if (s->cx == screen_size_x(s)) {
s->cx = 0; s->cx = 0;
@ -110,14 +112,20 @@ screen_write_put_character(struct screen_write_ctx *ctx, u_char ch)
screen_write_cursor_down_scroll(ctx); screen_write_cursor_down_scroll(ctx);
} else if (!screen_in_x(s, s->cx) || !screen_in_y(s, s->cy)) { } else if (!screen_in_x(s, s->cx) || !screen_in_y(s, s->cy)) {
SCREEN_DEBUG(s); SCREEN_DEBUG(s);
return; return (0);
} }
screen_display_set_cell(s, s->cx, s->cy, ch, s->attr, s->colr); screen_display_get_cell(s, s->cx, s->cy, &data, &attr, &colr);
if (ch != data || s->attr != attr || colr != s->colr) {
screen_display_set_cell(s, s->cx, s->cy, ch, s->attr, s->colr);
n = 1;
} else
n = 0;
s->cx++; s->cx++;
if (ctx->write != NULL) if (ctx->write != NULL)
ctx->write(ctx->data, TTY_CHARACTER, ch); ctx->write(ctx->data, TTY_CHARACTER, ch);
return (n);
} }
/* Put a string right-justified. */ /* Put a string right-justified. */

6
tmux.h
View File

@ -1,4 +1,4 @@
/* $Id: tmux.h,v 1.129 2008-06-04 17:54:26 nicm Exp $ */ /* $Id: tmux.h,v 1.130 2008-06-04 18:50:35 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -919,6 +919,8 @@ void input_parse(struct window *);
void input_key(struct window *, int); void input_key(struct window *, int);
/* screen-display.c */ /* screen-display.c */
void screen_display_get_cell(
struct screen *, u_int, u_int, u_char *, u_char *, u_char *);
void screen_display_set_cell( void screen_display_set_cell(
struct screen *, u_int, u_int, u_char, u_char, u_char); struct screen *, u_int, u_int, u_char, u_char, u_char);
void screen_display_make_lines(struct screen *, u_int, u_int); void screen_display_make_lines(struct screen *, u_int, u_int);
@ -946,7 +948,7 @@ void screen_write_start(struct screen_write_ctx *,
struct screen *, void (*)(void *, int, ...), void *); struct screen *, void (*)(void *, int, ...), void *);
void screen_write_stop(struct screen_write_ctx *); void screen_write_stop(struct screen_write_ctx *);
void screen_write_set_title(struct screen_write_ctx *, char *); void screen_write_set_title(struct screen_write_ctx *, char *);
void screen_write_put_character(struct screen_write_ctx *, u_char); int screen_write_put_character(struct screen_write_ctx *, u_char);
size_t printflike2 screen_write_put_string_rjust( size_t printflike2 screen_write_put_string_rjust(
struct screen_write_ctx *, const char *, ...); struct screen_write_ctx *, const char *, ...);
void printflike2 screen_write_put_string( void printflike2 screen_write_put_string(

View File

@ -1,4 +1,4 @@
/* $Id: window-copy.c,v 1.16 2008-06-03 21:42:37 nicm Exp $ */ /* $Id: window-copy.c,v 1.17 2008-06-04 18:50:35 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -184,9 +184,11 @@ window_copy_key(struct window *w, int key)
window_copy_copy_selection(w); window_copy_copy_selection(w);
window_reset_mode(w); window_reset_mode(w);
break; break;
case '0':
case '\001': /* C-a */ case '\001': /* C-a */
window_copy_cursor_start_of_line(w); window_copy_cursor_start_of_line(w);
break; break;
case '$':
case '\005': /* C-e */ case '\005': /* C-e */
window_copy_cursor_end_of_line(w); window_copy_cursor_end_of_line(w);
break; break;