summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2008-01-03 21:32:11 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2008-01-03 21:32:11 +0000
commit205b78ec588c2235bf037edb75b1fe2ac8d78386 (patch)
treefbcec5da406b1c1a8ace1979a4907ebd3bf91b21
parentb8e616f44555ac74f652375af76da2689afa9147 (diff)
Some key tweaks, fix status bar to not rely on attr.
-rw-r--r--TODO2
-rw-r--r--input-keys.c52
-rw-r--r--input.c12
-rw-r--r--screen-redraw.c10
-rw-r--r--screen.c4
-rw-r--r--status.c7
-rw-r--r--tmux.h3
-rw-r--r--window-more.c4
-rw-r--r--window-scroll.c4
9 files changed, 73 insertions, 25 deletions
diff --git a/TODO b/TODO
index 1f35518d..f1aa29ae 100644
--- a/TODO
+++ b/TODO
@@ -65,6 +65,8 @@
- window splitting?
- if only one arg to switch-window, assume source-index
- test on wsvt25, vt100, vt220
+- clear EOL etc CANNOT rely on it using the current colour/attr and should
+ not emulate it doing so - it should always fill with black
-- For 0.2 --------------------------------------------------------------------
- anything which uses cmd_{send,recv}_string will break if the string is
diff --git a/input-keys.c b/input-keys.c
index 07602242..c24eed94 100644
--- a/input-keys.c
+++ b/input-keys.c
@@ -1,4 +1,4 @@
-/* $Id: input-keys.c,v 1.5 2007-12-01 11:24:17 nicm Exp $ */
+/* $Id: input-keys.c,v 1.6 2008-01-03 21:32:11 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -29,7 +29,6 @@ struct {
const char *data;
} input_keys[] = {
{ KEYC_DC, "\e[3~" },
- { KEYC_DOWN, "\eOB" },
{ KEYC_F1, "\eOP" },
{ KEYC_F10, "\e[21~" },
{ KEYC_F11, "\e[23~" },
@@ -44,12 +43,20 @@ struct {
{ KEYC_F9, "\e[20~" },
{ KEYC_FIND, "\e[1~" },
{ KEYC_IC, "\e[2~" },
- { KEYC_LEFT, "\eOD" },
- { KEYC_SELECT, "\e[4~" },
{ KEYC_NPAGE, "\e[6~" },
{ KEYC_PPAGE, "\e[5~" },
+ { KEYC_SELECT, "\e[4~" },
+
+ { KEYC_UP, "\eOA" },
+ { KEYC_DOWN, "\eOB" },
+ { KEYC_LEFT, "\eOD" },
{ KEYC_RIGHT, "\eOC" },
- { KEYC_UP, "\eOA" }
+
+ { KEYC_A1, "\eOw" },
+ { KEYC_A3, "\eOy" },
+ { KEYC_B2, "\eOu" },
+ { KEYC_C1, "\eOq" },
+ { KEYC_C3, "\eOs" }
};
#define NINPUTKEYS (sizeof input_keys / sizeof input_keys[0])
@@ -65,6 +72,41 @@ input_key(struct window *w, int key)
return;
}
+#ifdef notyetifever
+/* XXX can't we just pass the keypad changes through to tty? */
+ if (!(w->screen->mode & MODE_KKEYPAD)) {
+ switch (key) {
+ case KEYC_A1:
+ buffer_write8(w->out, '9');
+ return;
+ case KEYC_UP:
+ buffer_write8(w->out, '8');
+ return;
+ case KEYC_A3:
+ buffer_write8(w->out, '7');
+ return;
+ case KEYC_LEFT:
+ buffer_write8(w->out, '6');
+ return;
+ case KEYC_B2:
+ buffer_write8(w->out, '5');
+ return;
+ case KEYC_RIGHT:
+ buffer_write8(w->out, '4');
+ return;
+ case KEYC_C1:
+ buffer_write8(w->out, '3');
+ return;
+ case KEYC_DOWN:
+ buffer_write8(w->out, '2');
+ return;
+ case KEYC_C3:
+ buffer_write8(w->out, '1');
+ return;
+ }
+ }
+#endif
+
for (i = 0; i < NINPUTKEYS; i++) {
if (input_keys[i].key == key) {
log_debug2(
diff --git a/input.c b/input.c
index f8088a89..13532cca 100644
--- a/input.c
+++ b/input.c
@@ -1,4 +1,4 @@
-/* $Id: input.c,v 1.45 2007-12-06 13:54:33 nicm Exp $ */
+/* $Id: input.c,v 1.46 2008-01-03 21:32:11 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -554,9 +554,11 @@ input_handle_private_two(u_char ch, struct input_ctx *ictx)
switch (ch) {
case '=': /* DECKPAM */
screen_write_set_mode(&ictx->ctx, MODE_KKEYPAD);
+ log_debug("kkeypad on");
break;
case '>': /* DECKPNM*/
screen_write_clear_mode(&ictx->ctx, MODE_KKEYPAD);
+ log_debug("kkeypad off");
break;
case '7': /* DECSC */
s->saved_cx = s->cx;
@@ -917,12 +919,15 @@ input_handle_sequence_sm(struct input_ctx *ictx)
switch (n) {
case 1: /* GATM */
screen_write_set_mode(&ictx->ctx, MODE_KCURSOR);
+ log_debug("kcursor on");
break;
case 25: /* TCEM */
screen_write_set_mode(&ictx->ctx, MODE_CURSOR);
+ log_debug("cursor on");
break;
case 1000:
screen_write_set_mode(&ictx->ctx, MODE_MOUSE);
+ log_debug("mouse on");
break;
default:
log_debug("unknown SM [%hhu]: %u", ictx->private, n);
@@ -932,6 +937,7 @@ input_handle_sequence_sm(struct input_ctx *ictx)
switch (n) {
case 4: /* IRM */
screen_write_set_mode(&ictx->ctx, MODE_INSERT);
+ log_debug("insert on");
break;
case 34:
/* Cursor high visibility not supported. */
@@ -957,12 +963,15 @@ input_handle_sequence_rm(struct input_ctx *ictx)
switch (n) {
case 1: /* GATM */
screen_write_clear_mode(&ictx->ctx, MODE_KCURSOR);
+ log_debug("kcursor off");
break;
case 25: /* TCEM */
screen_write_clear_mode(&ictx->ctx, MODE_CURSOR);
+ log_debug("cursor off");
break;
case 1000:
screen_write_clear_mode(&ictx->ctx, MODE_MOUSE);
+ log_debug("mouse off");
break;
default:
log_debug("unknown RM [%hhu]: %u", ictx->private, n);
@@ -972,6 +981,7 @@ input_handle_sequence_rm(struct input_ctx *ictx)
switch (n) {
case 4: /* IRM */
screen_write_clear_mode(&ictx->ctx, MODE_INSERT);
+ log_debug("insert off");
break;
case 34:
/* Cursor high visibility not supported. */
diff --git a/screen-redraw.c b/screen-redraw.c
index a386b9b0..ceb75ec4 100644
--- a/screen-redraw.c
+++ b/screen-redraw.c
@@ -1,4 +1,4 @@
-/* $Id: screen-redraw.c,v 1.3 2008-01-03 20:01:47 nicm Exp $ */
+/* $Id: screen-redraw.c,v 1.4 2008-01-03 21:32:11 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -161,14 +161,6 @@ screen_redraw_clear_screen(struct screen_redraw_ctx *ctx)
}
}
-/* Clear to end of line. */
-void
-screen_redraw_clear_end_of_line(struct screen_redraw_ctx *ctx)
-{
- if (ctx->s->cx < screen_last_x(ctx->s))
- ctx->write(ctx->data, TTY_CLEARENDOFLINE);
-}
-
/* Redraw single cell. */
void
screen_redraw_cell(struct screen_redraw_ctx *ctx, u_int px, u_int py)
diff --git a/screen.c b/screen.c
index b8a30075..432103cf 100644
--- a/screen.c
+++ b/screen.c
@@ -1,4 +1,4 @@
-/* $Id: screen.c,v 1.58 2007-12-06 22:13:14 nicm Exp $ */
+/* $Id: screen.c,v 1.59 2008-01-03 21:32:11 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -144,7 +144,7 @@ screen_create(struct screen *s, u_int dx, u_int dy)
s->attr = SCREEN_DEFATTR;
s->colr = SCREEN_DEFCOLR;
- s->mode = MODE_CURSOR;
+ s->mode = MODE_CURSOR|MODE_KCURSOR|MODE_KKEYPAD;
s->title = xstrdup("");
s->grid_data = xmalloc(dy * (sizeof *s->grid_data));
diff --git a/status.c b/status.c
index 8847e2d9..8e215ea5 100644
--- a/status.c
+++ b/status.c
@@ -1,4 +1,4 @@
-/* $Id: status.c,v 1.17 2008-01-03 20:01:47 nicm Exp $ */
+/* $Id: status.c,v 1.18 2008-01-03 21:32:11 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -52,7 +52,10 @@ status_write_client(struct client *c)
if (ctx.s->cx > screen_last_x(ctx.s))
break;
}
- screen_redraw_clear_end_of_line(&ctx);
+ while (ctx.s->cx < screen_size_x(ctx.s)) {
+ ctx.write(ctx.data, TTY_CHARACTER, ' ');
+ ctx.s->cx++;
+ }
screen_redraw_stop(&ctx);
}
diff --git a/tmux.h b/tmux.h
index e46abdf7..8073014d 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1,4 +1,4 @@
-/* $Id: tmux.h,v 1.113 2007-12-06 21:57:57 nicm Exp $ */
+/* $Id: tmux.h,v 1.114 2008-01-03 21:32:11 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -892,7 +892,6 @@ void screen_redraw_move_cursor(struct screen_redraw_ctx *, u_int, u_int);
void screen_redraw_set_attributes(struct screen_redraw_ctx *, u_int, u_int);
void printflike2 screen_redraw_write_string(
struct screen_redraw_ctx *, const char *, ...);
-void screen_redraw_clear_end_of_line(struct screen_redraw_ctx *);
void screen_redraw_clear_screen(struct screen_redraw_ctx *);
void screen_redraw_cell(struct screen_redraw_ctx *, u_int, u_int);
void screen_redraw_area(
diff --git a/window-more.c b/window-more.c
index b53f2b0d..51660445 100644
--- a/window-more.c
+++ b/window-more.c
@@ -1,4 +1,4 @@
-/* $Id: window-more.c,v 1.9 2007-12-07 09:26:56 nicm Exp $ */
+/* $Id: window-more.c,v 1.10 2008-01-03 21:32:11 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -93,7 +93,7 @@ window_more_init(struct window *w)
s = &data->screen;
screen_create(s, screen_size_x(&w->base), screen_size_y(&w->base));
- s->mode = 0;
+ s->mode &= ~MODE_CURSOR;
return (s);
}
diff --git a/window-scroll.c b/window-scroll.c
index dee8d094..1e86ba09 100644
--- a/window-scroll.c
+++ b/window-scroll.c
@@ -1,4 +1,4 @@
-/* $Id: window-scroll.c,v 1.16 2007-12-06 10:04:43 nicm Exp $ */
+/* $Id: window-scroll.c,v 1.17 2008-01-03 21:32:11 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -66,7 +66,7 @@ window_scroll_init(struct window *w)
s = &data->screen;
screen_create(s, screen_size_x(&w->base), screen_size_y(&w->base));
- s->mode = 0;
+ s->mode &= ~MODE_CURSOR;
screen_write_start(&ctx, s, NULL, NULL);
for (i = 0; i < screen_size_y(s); i++)