Update of /cvsroot/tmux/tmux
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv6404
Modified Files:
key-string.c tmux.h window-copy.c
Log Message:
Use a macro-based mask for obtaining a key or modifier-set from the combination.
Display C-@, etc, as C-Space, in list-keys.
Index: window-copy.c
===================================================================
RCS file: /cvsroot/tmux/tmux/window-copy.c,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -d -r1.118 -r1.119
--- window-copy.c 5 Jun 2010 07:48:35 -0000 1.118
+++ window-copy.c 5 Jun 2010 20:29:11 -0000 1.119
@@ -367,7 +367,7 @@
if (data->inputtype == WINDOW_COPY_JUMPFORWARD
|| data->inputtype == WINDOW_COPY_JUMPBACK) {
/* Ignore keys with modifiers. */
- if ((key & 0xff00) == 0) {
+ if ((key & KEYC_MASK_MOD) == 0) {
data->jumpchar = key;
if (data->inputtype == WINDOW_COPY_JUMPFORWARD) {
for (; np != 0; np--)
@@ -627,7 +627,7 @@
*data->inputstr = '\0';
goto input_on;
case MODEKEYCOPY_STARTNUMBERPREFIX:
- key &= 0xff;
+ key &= KEYC_MASK_KEY;
if (key >= '0' && key <= '9') {
data->inputtype = WINDOW_COPY_NUMERICPREFIX;
data->numprefix = 0;
@@ -741,7 +741,7 @@
struct window_copy_mode_data *data = wp->modedata;
struct screen *s = &data->screen;
- key &= 0xff;
+ key &= KEYC_MASK_KEY;
if (key < '0' || key > '9')
return 1;
Index: key-string.c
===================================================================
RCS file: /cvsroot/tmux/tmux/key-string.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- key-string.c 5 Jun 2010 06:27:19 -0000 1.33
+++ key-string.c 5 Jun 2010 20:29:11 -0000 1.34
@@ -184,6 +184,15 @@
*out = '\0';
+ /*
+ * Special case: display C-@ as C-Space. Could do this below in
+ * the (key >= 0 && key <= 32), but this way we let it be found
+ * in key_string_table, for the unlikely chance that we might
+ * change its name.
+ */
+ if ((key & KEYC_MASK_KEY) == 0)
+ key = ' ' | KEYC_CTRL | (key & KEYC_MASK_MOD);
+
/* Fill in the modifiers. */
if (key & KEYC_CTRL)
strlcat(out, "C-", sizeof out);
@@ -191,7 +200,7 @@
strlcat(out, "M-", sizeof out);
if (key & KEYC_SHIFT)
strlcat(out, "S-", sizeof out);
- key &= ~(KEYC_CTRL|KEYC_ESCAPE|KEYC_SHIFT);
+ key &= KEYC_MASK_KEY;
/* Try the key against the string table. */
for (i = 0; i < nitems(key_string_table); i++) {
Index: tmux.h
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.h,v
retrieving revision 1.558
retrieving revision 1.559
diff -u -d -r1.558 -r1.559
--- tmux.h 22 May 2010 21:56:04 -0000 1.558
+++ tmux.h 5 Jun 2010 20:29:11 -0000 1.559
@@ -110,6 +110,10 @@
#define KEYC_SHIFT 0x8000
#define KEYC_PREFIX 0x10000
+/* Mask to obtain key w/o modifiers */
+#define KEYC_MASK_MOD (KEYC_ESCAPE|KEYC_CTRL|KEYC_SHIFT|KEYC_PREFIX)
+#define KEYC_MASK_KEY (~KEYC_MASK_MOD)
+
/* Other key codes. */
enum key_code {
/* Mouse key. */
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs