mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
Support keypad. Change cursor key output.
This commit is contained in:
parent
5942e22d71
commit
97212771b5
10
CHANGES
10
CHANGES
@ -1,3 +1,11 @@
|
|||||||
|
24 July 2008
|
||||||
|
|
||||||
|
* Support the numeric keypad. This is really confusing: parts of it have termcap
|
||||||
|
entries and parts do not. I'm not sure I've got it right but this seems to
|
||||||
|
work.
|
||||||
|
* Change arrow keys from \033OA to \033[A to match screen's behaviour rather
|
||||||
|
than its termcap.
|
||||||
|
|
||||||
19 July 2008
|
19 July 2008
|
||||||
|
|
||||||
* Unbreak "set status" - tmux thought it was ambiguous, reported by rivo nurges.
|
* Unbreak "set status" - tmux thought it was ambiguous, reported by rivo nurges.
|
||||||
@ -614,4 +622,4 @@
|
|||||||
(including mutt, emacs). No status bar yet and no key remapping or other
|
(including mutt, emacs). No status bar yet and no key remapping or other
|
||||||
customisation.
|
customisation.
|
||||||
|
|
||||||
$Id: CHANGES,v 1.150 2008-07-19 10:07:50 nicm Exp $
|
$Id: CHANGES,v 1.151 2008-07-23 23:44:50 nicm Exp $
|
||||||
|
5
TODO
5
TODO
@ -36,9 +36,6 @@
|
|||||||
- split clients into three RB trees by fd: attached/unattached/dead?
|
- split clients into three RB trees by fd: attached/unattached/dead?
|
||||||
or tailqs? what would be fastest per-char?
|
or tailqs? what would be fastest per-char?
|
||||||
- window splitting?
|
- window splitting?
|
||||||
- why do up/down work in angband with screen but not tmux??
|
|
||||||
-- it's not kkeypad/kcursor
|
|
||||||
- fix kkeypad/kcursor
|
|
||||||
- c/p is still borken in some ways
|
- c/p is still borken in some ways
|
||||||
- poll(2) is broken on OS X/Darwin, a workaround for this would be nice
|
- poll(2) is broken on OS X/Darwin, a workaround for this would be nice
|
||||||
- different screen model? layers perhaps? hmm
|
- different screen model? layers perhaps? hmm
|
||||||
@ -46,6 +43,8 @@
|
|||||||
- better mode features: search, back word, forward word, etc
|
- better mode features: search, back word, forward word, etc
|
||||||
- flags to centre screen in window
|
- flags to centre screen in window
|
||||||
- get rid of DEFDATA etc
|
- get rid of DEFDATA etc
|
||||||
|
- better terminal emulation (identify, insert mode, some other bits)
|
||||||
|
- should we support kkeypad? looks like screen doesn't. what is kcursor?
|
||||||
|
|
||||||
-- For 0.5 --------------------------------------------------------------------
|
-- For 0.5 --------------------------------------------------------------------
|
||||||
|
|
||||||
|
76
input-keys.c
76
input-keys.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: input-keys.c,v 1.10 2008-06-25 07:30:08 nicm Exp $ */
|
/* $Id: input-keys.c,v 1.11 2008-07-23 23:44:50 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -28,13 +28,7 @@ struct {
|
|||||||
int key;
|
int key;
|
||||||
const char *data;
|
const char *data;
|
||||||
} input_keys[] = {
|
} input_keys[] = {
|
||||||
/* { KEYC_BACKSPACE, "\010" }, */
|
|
||||||
|
|
||||||
{ KEYC_DC, "\033[3~" },
|
|
||||||
{ KEYC_F1, "\033OP" },
|
{ KEYC_F1, "\033OP" },
|
||||||
{ KEYC_F10, "\033[21~" },
|
|
||||||
{ KEYC_F11, "\033[23~" },
|
|
||||||
{ KEYC_F12, "\033[24~" },
|
|
||||||
{ KEYC_F2, "\033OQ" },
|
{ KEYC_F2, "\033OQ" },
|
||||||
{ KEYC_F3, "\033OR" },
|
{ KEYC_F3, "\033OR" },
|
||||||
{ KEYC_F4, "\033OS" },
|
{ KEYC_F4, "\033OS" },
|
||||||
@ -43,22 +37,37 @@ struct {
|
|||||||
{ KEYC_F7, "\033[18~" },
|
{ KEYC_F7, "\033[18~" },
|
||||||
{ KEYC_F8, "\033[19~" },
|
{ KEYC_F8, "\033[19~" },
|
||||||
{ KEYC_F9, "\033[20~" },
|
{ KEYC_F9, "\033[20~" },
|
||||||
|
{ KEYC_F10, "\033[21~" },
|
||||||
|
{ KEYC_F11, "\033[23~" },
|
||||||
|
{ KEYC_F12, "\033[24~" },
|
||||||
{ KEYC_FIND, "\033[1~" },
|
{ KEYC_FIND, "\033[1~" },
|
||||||
|
{ KEYC_DC, "\033[3~" },
|
||||||
{ KEYC_IC, "\033[2~" },
|
{ KEYC_IC, "\033[2~" },
|
||||||
{ KEYC_NPAGE, "\033[6~" },
|
{ KEYC_NPAGE, "\033[6~" },
|
||||||
{ KEYC_PPAGE, "\033[5~" },
|
{ KEYC_PPAGE, "\033[5~" },
|
||||||
{ KEYC_SELECT, "\033[4~" },
|
{ KEYC_SELECT, "\033[4~" },
|
||||||
|
|
||||||
{ KEYC_UP, "\033OA" },
|
{ KEYC_UP, "\033[A" },
|
||||||
{ KEYC_DOWN, "\033OB" },
|
{ KEYC_DOWN, "\033[B" },
|
||||||
{ KEYC_LEFT, "\033OD" },
|
{ KEYC_LEFT, "\033[D" },
|
||||||
{ KEYC_RIGHT, "\033OC" },
|
{ KEYC_RIGHT, "\033[C" },
|
||||||
|
|
||||||
{ KEYC_A1, "\033Ow" },
|
{ KEYC_KP0_1, "\033Oo" },
|
||||||
{ KEYC_A3, "\033Oy" },
|
{ KEYC_KP0_2, "\033Oj" },
|
||||||
{ KEYC_B2, "\033Ou" },
|
{ KEYC_KP0_3, "\033Om" },
|
||||||
{ KEYC_C1, "\033Oq" },
|
{ KEYC_KP1_0, "\033Ow" },
|
||||||
{ KEYC_C3, "\033Os" }
|
{ KEYC_KP1_1, "\033Ox" },
|
||||||
|
{ KEYC_KP1_2, "\033Oy" },
|
||||||
|
{ KEYC_KP1_3, "\033Ok" },
|
||||||
|
{ KEYC_KP2_0, "\033Ot" },
|
||||||
|
{ KEYC_KP2_1, "\033Ou" },
|
||||||
|
{ KEYC_KP2_2, "\033Ov" },
|
||||||
|
{ KEYC_KP3_0, "\033Oq" },
|
||||||
|
{ KEYC_KP3_1, "\033Or" },
|
||||||
|
{ KEYC_KP3_2, "\033Os" },
|
||||||
|
{ KEYC_KP3_3, "\033OM" },
|
||||||
|
{ KEYC_KP4_0, "\033Op" },
|
||||||
|
{ KEYC_KP4_2, "\033On" },
|
||||||
};
|
};
|
||||||
#define NINPUTKEYS (sizeof input_keys / sizeof input_keys[0])
|
#define NINPUTKEYS (sizeof input_keys / sizeof input_keys[0])
|
||||||
|
|
||||||
@ -80,41 +89,6 @@ input_key(struct window *w, int key)
|
|||||||
return;
|
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++) {
|
for (i = 0; i < NINPUTKEYS; i++) {
|
||||||
if (input_keys[i].key == key)
|
if (input_keys[i].key == key)
|
||||||
break;
|
break;
|
||||||
|
8
input.c
8
input.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: input.c,v 1.50 2008-06-18 19:06:51 nicm Exp $ */
|
/* $Id: input.c,v 1.51 2008-07-23 23:44:50 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -557,11 +557,11 @@ input_handle_private_two(u_char ch, struct input_ctx *ictx)
|
|||||||
switch (ch) {
|
switch (ch) {
|
||||||
case '=': /* DECKPAM */
|
case '=': /* DECKPAM */
|
||||||
screen_write_set_mode(&ictx->ctx, MODE_KKEYPAD);
|
screen_write_set_mode(&ictx->ctx, MODE_KKEYPAD);
|
||||||
log_debug("kkeypad on");
|
log_debug("kkeypad on (application mode)");
|
||||||
break;
|
break;
|
||||||
case '>': /* DECKPNM*/
|
case '>': /* DECKPNM */
|
||||||
screen_write_clear_mode(&ictx->ctx, MODE_KKEYPAD);
|
screen_write_clear_mode(&ictx->ctx, MODE_KKEYPAD);
|
||||||
log_debug("kkeypad off");
|
log_debug("kkeypad off (number mode)");
|
||||||
break;
|
break;
|
||||||
case '7': /* DECSC */
|
case '7': /* DECSC */
|
||||||
s->saved_cx = s->cx;
|
s->saved_cx = s->cx;
|
||||||
|
34
key-string.c
34
key-string.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: key-string.c,v 1.6 2008-06-25 20:33:20 nicm Exp $ */
|
/* $Id: key-string.c,v 1.7 2008-07-23 23:44:50 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -26,13 +26,13 @@ struct {
|
|||||||
const char *string;
|
const char *string;
|
||||||
int key;
|
int key;
|
||||||
} key_string_table[] = {
|
} key_string_table[] = {
|
||||||
{ "A1", KEYC_A1 },
|
/* { "A1", KEYC_A1 }, */
|
||||||
{ "A3", KEYC_A3 },
|
/* { "A3", KEYC_A3 }, */
|
||||||
{ "B2", KEYC_B2 },
|
/* { "B2", KEYC_B2 }, */
|
||||||
{ "BEG", KEYC_BEG },
|
{ "BEG", KEYC_BEG },
|
||||||
{ "BTAB", KEYC_BTAB },
|
{ "BTAB", KEYC_BTAB },
|
||||||
{ "C1", KEYC_C1 },
|
/* { "C1", KEYC_C1 }, */
|
||||||
{ "C3", KEYC_C3 },
|
/* { "C3", KEYC_C3 }, */
|
||||||
{ "CANCEL", KEYC_CANCEL },
|
{ "CANCEL", KEYC_CANCEL },
|
||||||
{ "CATAB", KEYC_CATAB },
|
{ "CATAB", KEYC_CATAB },
|
||||||
{ "CLEAR", KEYC_CLEAR },
|
{ "CLEAR", KEYC_CLEAR },
|
||||||
@ -46,7 +46,7 @@ struct {
|
|||||||
{ "DOWN", KEYC_DOWN},
|
{ "DOWN", KEYC_DOWN},
|
||||||
{ "EIC", KEYC_EIC },
|
{ "EIC", KEYC_EIC },
|
||||||
{ "END", KEYC_END },
|
{ "END", KEYC_END },
|
||||||
{ "ENTER", KEYC_ENTER },
|
/* { "ENTER", KEYC_ENTER }, */
|
||||||
{ "EOL", KEYC_EOL },
|
{ "EOL", KEYC_EOL },
|
||||||
{ "EOS", KEYC_EOS },
|
{ "EOS", KEYC_EOS },
|
||||||
{ "EXIT", KEYC_EXIT },
|
{ "EXIT", KEYC_EXIT },
|
||||||
@ -173,7 +173,25 @@ struct {
|
|||||||
{ "SUNDO", KEYC_SUNDO },
|
{ "SUNDO", KEYC_SUNDO },
|
||||||
{ "SUSPEND", KEYC_SUSPEND },
|
{ "SUSPEND", KEYC_SUSPEND },
|
||||||
{ "UNDO", KEYC_UNDO },
|
{ "UNDO", KEYC_UNDO },
|
||||||
{ "UP", KEYC_UP }
|
{ "UP", KEYC_UP },
|
||||||
|
|
||||||
|
/* Numeric keypad. */
|
||||||
|
{ "KP/", KEYC_KP0_1 },
|
||||||
|
{ "KP*", KEYC_KP0_2 },
|
||||||
|
{ "KP-", KEYC_KP0_3 },
|
||||||
|
{ "KP7", KEYC_KP1_0 },
|
||||||
|
{ "KP8", KEYC_KP1_1 },
|
||||||
|
{ "KP9", KEYC_KP1_2 },
|
||||||
|
{ "KP+", KEYC_KP1_3 },
|
||||||
|
{ "KP4", KEYC_KP2_0 },
|
||||||
|
{ "KP5", KEYC_KP2_1 },
|
||||||
|
{ "KP6", KEYC_KP2_2 },
|
||||||
|
{ "KP1", KEYC_KP3_0 },
|
||||||
|
{ "KP2", KEYC_KP3_1 },
|
||||||
|
{ "KP3", KEYC_KP3_2 },
|
||||||
|
{ "KPENTER", KEYC_KP3_3 },
|
||||||
|
{ "KP0", KEYC_KP4_0 },
|
||||||
|
{ "KP.", KEYC_KP4_2 },
|
||||||
};
|
};
|
||||||
#define NKEYSTRINGS (sizeof key_string_table / sizeof key_string_table[0])
|
#define NKEYSTRINGS (sizeof key_string_table / sizeof key_string_table[0])
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: screen-write.c,v 1.8 2008-06-18 18:52:44 nicm Exp $ */
|
/* $Id: screen-write.c,v 1.9 2008-07-23 23:44:50 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -466,10 +466,6 @@ screen_write_set_mode(struct screen_write_ctx *ctx, int mode)
|
|||||||
|
|
||||||
if (mode & MODE_INSERT)
|
if (mode & MODE_INSERT)
|
||||||
ctx->write(ctx->data, TTY_INSERTON);
|
ctx->write(ctx->data, TTY_INSERTON);
|
||||||
if (mode & MODE_KCURSOR)
|
|
||||||
ctx->write(ctx->data, TTY_KCURSORON);
|
|
||||||
if (mode & MODE_KKEYPAD)
|
|
||||||
ctx->write(ctx->data, TTY_KKEYPADON);
|
|
||||||
if (mode & MODE_MOUSE)
|
if (mode & MODE_MOUSE)
|
||||||
ctx->write(ctx->data, TTY_MOUSEON);
|
ctx->write(ctx->data, TTY_MOUSEON);
|
||||||
}
|
}
|
||||||
@ -487,10 +483,6 @@ screen_write_clear_mode(struct screen_write_ctx *ctx, int mode)
|
|||||||
|
|
||||||
if (mode & MODE_INSERT)
|
if (mode & MODE_INSERT)
|
||||||
ctx->write(ctx->data, TTY_INSERTOFF);
|
ctx->write(ctx->data, TTY_INSERTOFF);
|
||||||
if (mode & MODE_KCURSOR)
|
|
||||||
ctx->write(ctx->data, TTY_KCURSOROFF);
|
|
||||||
if (mode & MODE_KKEYPAD)
|
|
||||||
ctx->write(ctx->data, TTY_KKEYPADOFF);
|
|
||||||
if (mode & MODE_MOUSE)
|
if (mode & MODE_MOUSE)
|
||||||
ctx->write(ctx->data, TTY_MOUSEOFF);
|
ctx->write(ctx->data, TTY_MOUSEOFF);
|
||||||
}
|
}
|
||||||
|
40
tmux.h
40
tmux.h
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tmux.h,v 1.175 2008-07-02 21:22:57 nicm Exp $ */
|
/* $Id: tmux.h,v 1.176 2008-07-23 23:44:50 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -155,14 +155,14 @@ struct buffer {
|
|||||||
#define KEYC_REMOVEESCAPE(k) ((k) & ~KEYC_ESCAPE)
|
#define KEYC_REMOVEESCAPE(k) ((k) & ~KEYC_ESCAPE)
|
||||||
#define KEYC_ISESCAPE(k) ((k) != KEYC_NONE && ((k) & KEYC_ESCAPE))
|
#define KEYC_ISESCAPE(k) ((k) != KEYC_NONE && ((k) & KEYC_ESCAPE))
|
||||||
|
|
||||||
#define KEYC_A1 (KEYC_OFFSET + 0x1)
|
/* #define KEYC_A1 (KEYC_OFFSET + 0x1) */
|
||||||
#define KEYC_A3 (KEYC_OFFSET + 0x2)
|
/* #define KEYC_A3 (KEYC_OFFSET + 0x2) */
|
||||||
#define KEYC_B2 (KEYC_OFFSET + 0x3)
|
/* #define KEYC_B2 (KEYC_OFFSET + 0x3) */
|
||||||
/* #define KEYC_BACKSPACE (KEYC_OFFSET + 0x4) */
|
/* #define KEYC_BACKSPACE (KEYC_OFFSET + 0x4) */
|
||||||
#define KEYC_BEG (KEYC_OFFSET + 0x5)
|
#define KEYC_BEG (KEYC_OFFSET + 0x5)
|
||||||
#define KEYC_BTAB (KEYC_OFFSET + 0x6)
|
#define KEYC_BTAB (KEYC_OFFSET + 0x6)
|
||||||
#define KEYC_C1 (KEYC_OFFSET + 0x7)
|
/* #define KEYC_C1 (KEYC_OFFSET + 0x7) */
|
||||||
#define KEYC_C3 (KEYC_OFFSET + 0x8)
|
/* #define KEYC_C3 (KEYC_OFFSET + 0x8) */
|
||||||
#define KEYC_CANCEL (KEYC_OFFSET + 0x9)
|
#define KEYC_CANCEL (KEYC_OFFSET + 0x9)
|
||||||
#define KEYC_CATAB (KEYC_OFFSET + 0xa)
|
#define KEYC_CATAB (KEYC_OFFSET + 0xa)
|
||||||
#define KEYC_CLEAR (KEYC_OFFSET + 0xb)
|
#define KEYC_CLEAR (KEYC_OFFSET + 0xb)
|
||||||
@ -176,7 +176,7 @@ struct buffer {
|
|||||||
#define KEYC_DOWN (KEYC_OFFSET + 0x13)
|
#define KEYC_DOWN (KEYC_OFFSET + 0x13)
|
||||||
#define KEYC_EIC (KEYC_OFFSET + 0x14)
|
#define KEYC_EIC (KEYC_OFFSET + 0x14)
|
||||||
#define KEYC_END (KEYC_OFFSET + 0x15)
|
#define KEYC_END (KEYC_OFFSET + 0x15)
|
||||||
#define KEYC_ENTER (KEYC_OFFSET + 0x16)
|
/* #define KEYC_ENTER (KEYC_OFFSET + 0x16) */
|
||||||
#define KEYC_EOL (KEYC_OFFSET + 0x17)
|
#define KEYC_EOL (KEYC_OFFSET + 0x17)
|
||||||
#define KEYC_EOS (KEYC_OFFSET + 0x18)
|
#define KEYC_EOS (KEYC_OFFSET + 0x18)
|
||||||
#define KEYC_EXIT (KEYC_OFFSET + 0x19)
|
#define KEYC_EXIT (KEYC_OFFSET + 0x19)
|
||||||
@ -306,6 +306,24 @@ struct buffer {
|
|||||||
#define KEYC_UP (KEYC_OFFSET + 0x95)
|
#define KEYC_UP (KEYC_OFFSET + 0x95)
|
||||||
#define KEYC_MOUSE (KEYC_OFFSET + 0x96)
|
#define KEYC_MOUSE (KEYC_OFFSET + 0x96)
|
||||||
|
|
||||||
|
/* Numeric keypad. Numbered from top-left, KPY_X. */
|
||||||
|
#define KEYC_KP0_1 (KEYC_OFFSET + 0x100)
|
||||||
|
#define KEYC_KP0_2 (KEYC_OFFSET + 0x101)
|
||||||
|
#define KEYC_KP0_3 (KEYC_OFFSET + 0x102)
|
||||||
|
#define KEYC_KP1_0 (KEYC_OFFSET + 0x103)
|
||||||
|
#define KEYC_KP1_1 (KEYC_OFFSET + 0x104)
|
||||||
|
#define KEYC_KP1_2 (KEYC_OFFSET + 0x105)
|
||||||
|
#define KEYC_KP1_3 (KEYC_OFFSET + 0x106)
|
||||||
|
#define KEYC_KP2_0 (KEYC_OFFSET + 0x107)
|
||||||
|
#define KEYC_KP2_1 (KEYC_OFFSET + 0x108)
|
||||||
|
#define KEYC_KP2_2 (KEYC_OFFSET + 0x109)
|
||||||
|
#define KEYC_KP3_0 (KEYC_OFFSET + 0x10a)
|
||||||
|
#define KEYC_KP3_1 (KEYC_OFFSET + 0x10b)
|
||||||
|
#define KEYC_KP3_2 (KEYC_OFFSET + 0x10c)
|
||||||
|
#define KEYC_KP3_3 (KEYC_OFFSET + 0x10d)
|
||||||
|
#define KEYC_KP4_0 (KEYC_OFFSET + 0x10e)
|
||||||
|
#define KEYC_KP4_2 (KEYC_OFFSET + 0x10f)
|
||||||
|
|
||||||
/* Output codes. */
|
/* Output codes. */
|
||||||
#define TTY_CHARACTER 0
|
#define TTY_CHARACTER 0
|
||||||
#define TTY_CURSORUP 1
|
#define TTY_CURSORUP 1
|
||||||
@ -327,12 +345,8 @@ struct buffer {
|
|||||||
#define TTY_SCROLLREGION 17
|
#define TTY_SCROLLREGION 17
|
||||||
#define TTY_INSERTON 18
|
#define TTY_INSERTON 18
|
||||||
#define TTY_INSERTOFF 19
|
#define TTY_INSERTOFF 19
|
||||||
#define TTY_KCURSOROFF 20
|
#define TTY_MOUSEON 20
|
||||||
#define TTY_KCURSORON 21
|
#define TTY_MOUSEOFF 21 /* XXX merge all on/off into 1 arg? */
|
||||||
#define TTY_KKEYPADOFF 22
|
|
||||||
#define TTY_KKEYPADON 23
|
|
||||||
#define TTY_MOUSEON 24
|
|
||||||
#define TTY_MOUSEOFF 25 /* XXX merge all on/off into 1 arg? */
|
|
||||||
|
|
||||||
/* Message codes. */
|
/* Message codes. */
|
||||||
enum hdrtype {
|
enum hdrtype {
|
||||||
|
49
tty-keys.c
49
tty-keys.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tty-keys.c,v 1.6 2008-07-23 22:18:06 nicm Exp $ */
|
/* $Id: tty-keys.c,v 1.7 2008-07-23 23:44:50 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -27,8 +27,13 @@ struct {
|
|||||||
const char *name;
|
const char *name;
|
||||||
int code;
|
int code;
|
||||||
} tty_keys[] = {
|
} tty_keys[] = {
|
||||||
|
/* { "ka1", KEYC_A1 }, */
|
||||||
|
/* { "ka3", KEYC_A3 }, */
|
||||||
|
/* { "kb2", KEYC_B2 }, */
|
||||||
/* { "kb", KEYC_BACKSPACE }, */
|
/* { "kb", KEYC_BACKSPACE }, */
|
||||||
{ "kBEG", KEYC_SBEG },
|
{ "kBEG", KEYC_SBEG },
|
||||||
|
/* { "kc1", KEYC_C1 }, */
|
||||||
|
/* { "kc3", KEYC_C3 }, */
|
||||||
{ "kCAN", KEYC_SCANCEL },
|
{ "kCAN", KEYC_SCANCEL },
|
||||||
{ "kCMD", KEYC_SCOMMAND },
|
{ "kCMD", KEYC_SCOMMAND },
|
||||||
{ "kCPY", KEYC_SCOPY },
|
{ "kCPY", KEYC_SCOPY },
|
||||||
@ -56,12 +61,7 @@ struct {
|
|||||||
{ "kSAV", KEYC_SSAVE },
|
{ "kSAV", KEYC_SSAVE },
|
||||||
{ "kSPD", KEYC_SSUSPEND },
|
{ "kSPD", KEYC_SSUSPEND },
|
||||||
{ "kUND", KEYC_SUNDO },
|
{ "kUND", KEYC_SUNDO },
|
||||||
{ "ka1", KEYC_A1 },
|
|
||||||
{ "ka3", KEYC_A3 },
|
|
||||||
{ "kb2", KEYC_B2 },
|
|
||||||
{ "kbeg", KEYC_BEG },
|
{ "kbeg", KEYC_BEG },
|
||||||
{ "kc1", KEYC_C1 },
|
|
||||||
{ "kc3", KEYC_C3 },
|
|
||||||
{ "kcan", KEYC_CANCEL },
|
{ "kcan", KEYC_CANCEL },
|
||||||
{ "kcbt", KEYC_BTAB },
|
{ "kcbt", KEYC_BTAB },
|
||||||
{ "kclo", KEYC_CLOSE },
|
{ "kclo", KEYC_CLOSE },
|
||||||
@ -79,7 +79,7 @@ struct {
|
|||||||
{ "ked", KEYC_EOS },
|
{ "ked", KEYC_EOS },
|
||||||
{ "kel", KEYC_EOL },
|
{ "kel", KEYC_EOL },
|
||||||
{ "kend", KEYC_END },
|
{ "kend", KEYC_END },
|
||||||
{ "kent", KEYC_ENTER },
|
/* { "kent", KEYC_ENTER }, */
|
||||||
{ "kext", KEYC_EXIT },
|
{ "kext", KEYC_EXIT },
|
||||||
{ "kf0", KEYC_F0 },
|
{ "kf0", KEYC_F0 },
|
||||||
{ "kf1", KEYC_F1 },
|
{ "kf1", KEYC_F1 },
|
||||||
@ -177,6 +177,29 @@ struct {
|
|||||||
{ "ktbc", KEYC_CATAB },
|
{ "ktbc", KEYC_CATAB },
|
||||||
{ "kund", KEYC_UNDO },
|
{ "kund", KEYC_UNDO },
|
||||||
{ "pmous", KEYC_MOUSE },
|
{ "pmous", KEYC_MOUSE },
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Number keypad.
|
||||||
|
*
|
||||||
|
* This is totally confusing and I still don't quite understand how it
|
||||||
|
* all fits together in relation to termcap...
|
||||||
|
*/
|
||||||
|
{ "-\033Oo", KEYC_KP0_1 },
|
||||||
|
{ "-\033Oj", KEYC_KP0_2 },
|
||||||
|
{ "-\033Om", KEYC_KP0_3 },
|
||||||
|
{ "-\033Ow", KEYC_KP1_0 },
|
||||||
|
{ "-\033Ox", KEYC_KP1_1 },
|
||||||
|
{ "-\033Oy", KEYC_KP1_2 },
|
||||||
|
{ "-\033Ok", KEYC_KP1_3 },
|
||||||
|
{ "-\033Ot", KEYC_KP2_0 },
|
||||||
|
{ "-\033Ou", KEYC_KP2_1 },
|
||||||
|
{ "-\033Ov", KEYC_KP2_2 },
|
||||||
|
{ "-\033Oq", KEYC_KP3_0 },
|
||||||
|
{ "-\033Or", KEYC_KP3_1 },
|
||||||
|
{ "-\033Os", KEYC_KP3_2 },
|
||||||
|
{ "-\033OM", KEYC_KP3_3 },
|
||||||
|
{ "-\033Op", KEYC_KP4_0 },
|
||||||
|
{ "-\033On", KEYC_KP4_2 },
|
||||||
};
|
};
|
||||||
#define NTTYKEYS (sizeof tty_keys / sizeof tty_keys[0])
|
#define NTTYKEYS (sizeof tty_keys / sizeof tty_keys[0])
|
||||||
|
|
||||||
@ -195,15 +218,19 @@ tty_keys_init(struct tty *tty)
|
|||||||
{
|
{
|
||||||
struct tty_key *tk;
|
struct tty_key *tk;
|
||||||
u_int i;
|
u_int i;
|
||||||
char *s;
|
const char *s;
|
||||||
|
|
||||||
RB_INIT(&tty->ktree);
|
RB_INIT(&tty->ktree);
|
||||||
|
|
||||||
tty->ksize = 0;
|
tty->ksize = 0;
|
||||||
for (i = 0; i < NTTYKEYS; i++) {
|
for (i = 0; i < NTTYKEYS; i++) {
|
||||||
s = tigetstr(tty_keys[i].name);
|
if (*tty_keys[i].name == '-')
|
||||||
if (s == (char *) -1 || s == (char *) 0)
|
s = tty_keys[i].name + 1;
|
||||||
continue;
|
else {
|
||||||
|
s = tigetstr(tty_keys[i].name);
|
||||||
|
if (s == (char *) -1 || s == (char *) 0)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (s[0] != '\033' || s[1] == '\0')
|
if (s[0] != '\033' || s[1] == '\0')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
20
tty.c
20
tty.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tty.c,v 1.36 2008-07-02 16:18:24 nicm Exp $ */
|
/* $Id: tty.c,v 1.37 2008-07-23 23:44:50 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -570,24 +570,6 @@ tty_vwrite(struct tty *tty, struct screen *s, int cmd, va_list ap)
|
|||||||
if (exit_insert_mode != NULL)
|
if (exit_insert_mode != NULL)
|
||||||
tty_puts(tty, exit_insert_mode);
|
tty_puts(tty, exit_insert_mode);
|
||||||
break;
|
break;
|
||||||
case TTY_KCURSOROFF:
|
|
||||||
t = tigetstr("CE");
|
|
||||||
if (t != (char *) 0 && t != (char *) -1)
|
|
||||||
tty_puts(tty, t);
|
|
||||||
break;
|
|
||||||
case TTY_KCURSORON:
|
|
||||||
t = tigetstr("CS");
|
|
||||||
if (t != (char *) 0 && t != (char *) -1)
|
|
||||||
tty_puts(tty, t);
|
|
||||||
break;
|
|
||||||
case TTY_KKEYPADOFF:
|
|
||||||
if (keypad_local != NULL)
|
|
||||||
tty_puts(tty, keypad_local);
|
|
||||||
break;
|
|
||||||
case TTY_KKEYPADON:
|
|
||||||
if (keypad_xmit != NULL)
|
|
||||||
tty_puts(tty, keypad_xmit);
|
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
case TTY_MOUSEOFF:
|
case TTY_MOUSEOFF:
|
||||||
if (key_mouse != NULL)
|
if (key_mouse != NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user