mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
Some key tweaks, fix status bar to not rely on attr.
This commit is contained in:
parent
b8e616f445
commit
205b78ec58
2
TODO
2
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
|
||||
|
52
input-keys.c
52
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(
|
||||
|
12
input.c
12
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. */
|
||||
|
@ -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)
|
||||
|
4
screen.c
4
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));
|
||||
|
7
status.c
7
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);
|
||||
}
|
||||
|
3
tmux.h
3
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(
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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++)
|
||||
|
Loading…
Reference in New Issue
Block a user