Handle escaped keys properly and use M-f/M-b in copy mode.

This commit is contained in:
Nicholas Marriott 2008-06-25 07:30:08 +00:00
parent cb6c14502b
commit 758efb3947
6 changed files with 277 additions and 191 deletions

View File

@ -1,3 +1,9 @@
25 June 2008
* Handle escaped keys properly (parse eg \033b into a single key code) and
use this to change copy mode next/previous work to M-f and M-b to match
emacs.
24 June 2008
* Next word (C-n/w) and previous word (C-b/b) in copy mode.
@ -562,4 +568,4 @@
(including mutt, emacs). No status bar yet and no key remapping or other
customisation.
$Id: CHANGES,v 1.139 2008-06-24 07:00:38 nicm Exp $
$Id: CHANGES,v 1.140 2008-06-25 07:30:08 nicm Exp $

2
TODO
View File

@ -59,9 +59,11 @@
- problems with force-width when wrapping line in emacs?
- command history for command-prompt. better tab completion (use options too)
- window options should be done similarly to standard options
- next prev word etc in command prompt
---
- document list-commands. document switch-client
- document buffer stuff
- document next/prev word
---
save-buffer -b number filename
load-buffer -b number filename

View File

@ -1,4 +1,4 @@
/* $Id: input-keys.c,v 1.9 2008-06-23 16:58:49 nicm Exp $ */
/* $Id: input-keys.c,v 1.10 2008-06-25 07:30:08 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -68,8 +68,14 @@ input_key(struct window *w, int key)
{
u_int i;
log_debug2("writing key %d", key);
if (key != KEYC_NONE && key >= 0) {
log_debug2("writing key %x", key);
if (KEYC_ISESCAPE(key)) {
buffer_write8(w->out, '\033');
key = KEYC_REMOVEESCAPE(key);
}
if (key != KEYC_NONE && key < KEYC_OFFSET) {
buffer_write8(w->out, (uint8_t) key);
return;
}

314
tmux.h
View File

@ -1,4 +1,4 @@
/* $Id: tmux.h,v 1.167 2008-06-23 22:24:16 nicm Exp $ */
/* $Id: tmux.h,v 1.168 2008-06-25 07:30:08 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -145,157 +145,164 @@ struct buffer {
#define BELL_CURRENT 2
/* Key codes. ncurses defines KEY_*. Grrr. */
#define KEYC_NONE 256
#define KEYC_A1 -1
#define KEYC_A3 -2
#define KEYC_B2 -3
/* #define KEYC_BACKSPACE -4 */
#define KEYC_BEG -5
#define KEYC_BTAB -6
#define KEYC_C1 -7
#define KEYC_C3 -8
#define KEYC_CANCEL -9
#define KEYC_CATAB -10
#define KEYC_CLEAR -11
#define KEYC_CLOSE -12
#define KEYC_COMMAND -13
#define KEYC_COPY -14
#define KEYC_CREATE -15
#define KEYC_CTAB -16
#define KEYC_DC -17
#define KEYC_DL -18
#define KEYC_DOWN -19
#define KEYC_EIC -20
#define KEYC_END -21
#define KEYC_ENTER -22
#define KEYC_EOL -23
#define KEYC_EOS -24
#define KEYC_EXIT -25
#define KEYC_F0 -26
#define KEYC_F1 -27
#define KEYC_F10 -28
#define KEYC_F11 -29
#define KEYC_F12 -30
#define KEYC_F13 -31
#define KEYC_F14 -32
#define KEYC_F15 -33
#define KEYC_F16 -34
#define KEYC_F17 -35
#define KEYC_F18 -36
#define KEYC_F19 -37
#define KEYC_F2 -38
#define KEYC_F20 -39
#define KEYC_F21 -40
#define KEYC_F22 -41
#define KEYC_F23 -42
#define KEYC_F24 -43
#define KEYC_F25 -44
#define KEYC_F26 -45
#define KEYC_F27 -46
#define KEYC_F28 -47
#define KEYC_F29 -48
#define KEYC_F3 -49
#define KEYC_F30 -50
#define KEYC_F31 -51
#define KEYC_F32 -52
#define KEYC_F33 -53
#define KEYC_F34 -54
#define KEYC_F35 -55
#define KEYC_F36 -56
#define KEYC_F37 -57
#define KEYC_F38 -58
#define KEYC_F39 -59
#define KEYC_F4 -60
#define KEYC_F40 -61
#define KEYC_F41 -62
#define KEYC_F42 -63
#define KEYC_F43 -64
#define KEYC_F44 -65
#define KEYC_F45 -66
#define KEYC_F46 -67
#define KEYC_F47 -68
#define KEYC_F48 -69
#define KEYC_F49 -70
#define KEYC_F5 -71
#define KEYC_F50 -72
#define KEYC_F51 -73
#define KEYC_F52 -74
#define KEYC_F53 -75
#define KEYC_F54 -76
#define KEYC_F55 -77
#define KEYC_F56 -78
#define KEYC_F57 -79
#define KEYC_F58 -80
#define KEYC_F59 -81
#define KEYC_F6 -82
#define KEYC_F60 -83
#define KEYC_F61 -84
#define KEYC_F62 -85
#define KEYC_F63 -86
#define KEYC_F7 -87
#define KEYC_F8 -88
#define KEYC_F9 -89
#define KEYC_FIND -90
#define KEYC_HELP -91
#define KEYC_HOME -92
#define KEYC_IC -93
#define KEYC_IL -94
#define KEYC_LEFT -95
#define KEYC_LL -96
#define KEYC_MARK -97
#define KEYC_MESSAGE -98
#define KEYC_MOVE -99
#define KEYC_NEXT -100
#define KEYC_NPAGE -101
#define KEYC_OPEN -102
#define KEYC_OPTIONS -103
#define KEYC_PPAGE -104
#define KEYC_PREVIOUS -105
#define KEYC_PRINT -106
#define KEYC_REDO -107
#define KEYC_REFERENCE -108
#define KEYC_REFRESH -109
#define KEYC_REPLACE -110
#define KEYC_RESTART -111
#define KEYC_RESUME -112
#define KEYC_RIGHT -113
#define KEYC_SAVE -114
#define KEYC_SBEG -115
#define KEYC_SCANCEL -116
#define KEYC_SCOMMAND -117
#define KEYC_SCOPY -118
#define KEYC_SCREATE -119
#define KEYC_SDC -120
#define KEYC_SDL -121
#define KEYC_SELECT -122
#define KEYC_SEND -123
#define KEYC_SEOL -124
#define KEYC_SEXIT -125
#define KEYC_SF -126
#define KEYC_SFIND -127
#define KEYC_SHELP -128
#define KEYC_SHOME -129
#define KEYC_SIC -130
#define KEYC_SLEFT -131
#define KEYC_SMESSAGE -132
#define KEYC_SMOVE -133
#define KEYC_SNEXT -134
#define KEYC_SOPTIONS -135
#define KEYC_SPREVIOUS -136
#define KEYC_SPRINT -137
#define KEYC_SR -138
#define KEYC_SREDO -139
#define KEYC_SREPLACE -140
#define KEYC_SRIGHT -141
#define KEYC_SRSUME -142
#define KEYC_SSAVE -143
#define KEYC_SSUSPEND -144
#define KEYC_STAB -145
#define KEYC_SUNDO -146
#define KEYC_SUSPEND -147
#define KEYC_UNDO -148
#define KEYC_UP -149
#define KEYC_MOUSE -150
#define KEYC_NONE 0x0ffff
#define KEYC_OFFSET 0x10000
#define KEYC_ESCAPE 0x20000
#define KEYC_ADDESCAPE(k) ((k) | KEYC_ESCAPE)
#define KEYC_REMOVEESCAPE(k) ((k) & ~KEYC_ESCAPE)
#define KEYC_ISESCAPE(k) ((k) != KEYC_NONE && ((k) & KEYC_ESCAPE))
#define KEYC_A1 (KEYC_OFFSET + 0x1)
#define KEYC_A3 (KEYC_OFFSET + 0x2)
#define KEYC_B2 (KEYC_OFFSET + 0x3)
/* #define KEYC_BACKSPACE (KEYC_OFFSET + 0x4) */
#define KEYC_BEG (KEYC_OFFSET + 0x5)
#define KEYC_BTAB (KEYC_OFFSET + 0x6)
#define KEYC_C1 (KEYC_OFFSET + 0x7)
#define KEYC_C3 (KEYC_OFFSET + 0x8)
#define KEYC_CANCEL (KEYC_OFFSET + 0x9)
#define KEYC_CATAB (KEYC_OFFSET + 0xa)
#define KEYC_CLEAR (KEYC_OFFSET + 0xb)
#define KEYC_CLOSE (KEYC_OFFSET + 0xc)
#define KEYC_COMMAND (KEYC_OFFSET + 0xd)
#define KEYC_COPY (KEYC_OFFSET + 0xe)
#define KEYC_CREATE (KEYC_OFFSET + 0xf)
#define KEYC_CTAB (KEYC_OFFSET + 0x10)
#define KEYC_DC (KEYC_OFFSET + 0x11)
#define KEYC_DL (KEYC_OFFSET + 0x12)
#define KEYC_DOWN (KEYC_OFFSET + 0x13)
#define KEYC_EIC (KEYC_OFFSET + 0x14)
#define KEYC_END (KEYC_OFFSET + 0x15)
#define KEYC_ENTER (KEYC_OFFSET + 0x16)
#define KEYC_EOL (KEYC_OFFSET + 0x17)
#define KEYC_EOS (KEYC_OFFSET + 0x18)
#define KEYC_EXIT (KEYC_OFFSET + 0x19)
#define KEYC_F0 (KEYC_OFFSET + 0x1a)
#define KEYC_F1 (KEYC_OFFSET + 0x1b)
#define KEYC_F10 (KEYC_OFFSET + 0x1c)
#define KEYC_F11 (KEYC_OFFSET + 0x1d)
#define KEYC_F12 (KEYC_OFFSET + 0x1e)
#define KEYC_F13 (KEYC_OFFSET + 0x1f)
#define KEYC_F14 (KEYC_OFFSET + 0x20)
#define KEYC_F15 (KEYC_OFFSET + 0x21)
#define KEYC_F16 (KEYC_OFFSET + 0x22)
#define KEYC_F17 (KEYC_OFFSET + 0x23)
#define KEYC_F18 (KEYC_OFFSET + 0x24)
#define KEYC_F19 (KEYC_OFFSET + 0x25)
#define KEYC_F2 (KEYC_OFFSET + 0x26)
#define KEYC_F20 (KEYC_OFFSET + 0x27)
#define KEYC_F21 (KEYC_OFFSET + 0x28)
#define KEYC_F22 (KEYC_OFFSET + 0x29)
#define KEYC_F23 (KEYC_OFFSET + 0x2a)
#define KEYC_F24 (KEYC_OFFSET + 0x2b)
#define KEYC_F25 (KEYC_OFFSET + 0x2c)
#define KEYC_F26 (KEYC_OFFSET + 0x2d)
#define KEYC_F27 (KEYC_OFFSET + 0x2e)
#define KEYC_F28 (KEYC_OFFSET + 0x2f)
#define KEYC_F29 (KEYC_OFFSET + 0x30)
#define KEYC_F3 (KEYC_OFFSET + 0x31)
#define KEYC_F30 (KEYC_OFFSET + 0x32)
#define KEYC_F31 (KEYC_OFFSET + 0x33)
#define KEYC_F32 (KEYC_OFFSET + 0x34)
#define KEYC_F33 (KEYC_OFFSET + 0x35)
#define KEYC_F34 (KEYC_OFFSET + 0x36)
#define KEYC_F35 (KEYC_OFFSET + 0x37)
#define KEYC_F36 (KEYC_OFFSET + 0x38)
#define KEYC_F37 (KEYC_OFFSET + 0x39)
#define KEYC_F38 (KEYC_OFFSET + 0x3a)
#define KEYC_F39 (KEYC_OFFSET + 0x3b)
#define KEYC_F4 (KEYC_OFFSET + 0x3c)
#define KEYC_F40 (KEYC_OFFSET + 0x3d)
#define KEYC_F41 (KEYC_OFFSET + 0x3e)
#define KEYC_F42 (KEYC_OFFSET + 0x3f)
#define KEYC_F43 (KEYC_OFFSET + 0x40)
#define KEYC_F44 (KEYC_OFFSET + 0x41)
#define KEYC_F45 (KEYC_OFFSET + 0x42)
#define KEYC_F46 (KEYC_OFFSET + 0x43)
#define KEYC_F47 (KEYC_OFFSET + 0x44)
#define KEYC_F48 (KEYC_OFFSET + 0x45)
#define KEYC_F49 (KEYC_OFFSET + 0x46)
#define KEYC_F5 (KEYC_OFFSET + 0x47)
#define KEYC_F50 (KEYC_OFFSET + 0x48)
#define KEYC_F51 (KEYC_OFFSET + 0x49)
#define KEYC_F52 (KEYC_OFFSET + 0x4a)
#define KEYC_F53 (KEYC_OFFSET + 0x4b)
#define KEYC_F54 (KEYC_OFFSET + 0x4c)
#define KEYC_F55 (KEYC_OFFSET + 0x4d)
#define KEYC_F56 (KEYC_OFFSET + 0x4e)
#define KEYC_F57 (KEYC_OFFSET + 0x4f)
#define KEYC_F58 (KEYC_OFFSET + 0x50)
#define KEYC_F59 (KEYC_OFFSET + 0x51)
#define KEYC_F6 (KEYC_OFFSET + 0x52)
#define KEYC_F60 (KEYC_OFFSET + 0x53)
#define KEYC_F61 (KEYC_OFFSET + 0x54)
#define KEYC_F62 (KEYC_OFFSET + 0x55)
#define KEYC_F63 (KEYC_OFFSET + 0x56)
#define KEYC_F7 (KEYC_OFFSET + 0x57)
#define KEYC_F8 (KEYC_OFFSET + 0x58)
#define KEYC_F9 (KEYC_OFFSET + 0x59)
#define KEYC_FIND (KEYC_OFFSET + 0x5a)
#define KEYC_HELP (KEYC_OFFSET + 0x5b)
#define KEYC_HOME (KEYC_OFFSET + 0x5c)
#define KEYC_IC (KEYC_OFFSET + 0x5d)
#define KEYC_IL (KEYC_OFFSET + 0x5e)
#define KEYC_LEFT (KEYC_OFFSET + 0x5f)
#define KEYC_LL (KEYC_OFFSET + 0x60)
#define KEYC_MARK (KEYC_OFFSET + 0x61)
#define KEYC_MESSAGE (KEYC_OFFSET + 0x62)
#define KEYC_MOVE (KEYC_OFFSET + 0x63)
#define KEYC_NEXT (KEYC_OFFSET + 0x64)
#define KEYC_NPAGE (KEYC_OFFSET + 0x65)
#define KEYC_OPEN (KEYC_OFFSET + 0x66)
#define KEYC_OPTIONS (KEYC_OFFSET + 0x67)
#define KEYC_PPAGE (KEYC_OFFSET + 0x68)
#define KEYC_PREVIOUS (KEYC_OFFSET + 0x69)
#define KEYC_PRINT (KEYC_OFFSET + 0x6a)
#define KEYC_REDO (KEYC_OFFSET + 0x6b)
#define KEYC_REFERENCE (KEYC_OFFSET + 0x6c)
#define KEYC_REFRESH (KEYC_OFFSET + 0x6d)
#define KEYC_REPLACE (KEYC_OFFSET + 0x6e)
#define KEYC_RESTART (KEYC_OFFSET + 0x6f)
#define KEYC_RESUME (KEYC_OFFSET + 0x70)
#define KEYC_RIGHT (KEYC_OFFSET + 0x71)
#define KEYC_SAVE (KEYC_OFFSET + 0x72)
#define KEYC_SBEG (KEYC_OFFSET + 0x73)
#define KEYC_SCANCEL (KEYC_OFFSET + 0x74)
#define KEYC_SCOMMAND (KEYC_OFFSET + 0x75)
#define KEYC_SCOPY (KEYC_OFFSET + 0x76)
#define KEYC_SCREATE (KEYC_OFFSET + 0x77)
#define KEYC_SDC (KEYC_OFFSET + 0x78)
#define KEYC_SDL (KEYC_OFFSET + 0x79)
#define KEYC_SELECT (KEYC_OFFSET + 0x7a)
#define KEYC_SEND (KEYC_OFFSET + 0x7b)
#define KEYC_SEOL (KEYC_OFFSET + 0x7c)
#define KEYC_SEXIT (KEYC_OFFSET + 0x7d)
#define KEYC_SF (KEYC_OFFSET + 0x7e)
#define KEYC_SFIND (KEYC_OFFSET + 0x7f)
#define KEYC_SHELP (KEYC_OFFSET + 0x80)
#define KEYC_SHOME (KEYC_OFFSET + 0x81)
#define KEYC_SIC (KEYC_OFFSET + 0x82)
#define KEYC_SLEFT (KEYC_OFFSET + 0x83)
#define KEYC_SMESSAGE (KEYC_OFFSET + 0x84)
#define KEYC_SMOVE (KEYC_OFFSET + 0x85)
#define KEYC_SNEXT (KEYC_OFFSET + 0x86)
#define KEYC_SOPTIONS (KEYC_OFFSET + 0x87)
#define KEYC_SPREVIOUS (KEYC_OFFSET + 0x88)
#define KEYC_SPRINT (KEYC_OFFSET + 0x89)
#define KEYC_SR (KEYC_OFFSET + 0x8a)
#define KEYC_SREDO (KEYC_OFFSET + 0x8b)
#define KEYC_SREPLACE (KEYC_OFFSET + 0x8c)
#define KEYC_SRIGHT (KEYC_OFFSET + 0x8d)
#define KEYC_SRSUME (KEYC_OFFSET + 0x8e)
#define KEYC_SSAVE (KEYC_OFFSET + 0x8f)
#define KEYC_SSUSPEND (KEYC_OFFSET + 0x90)
#define KEYC_STAB (KEYC_OFFSET + 0x91)
#define KEYC_SUNDO (KEYC_OFFSET + 0x92)
#define KEYC_SUSPEND (KEYC_OFFSET + 0x93)
#define KEYC_UNDO (KEYC_OFFSET + 0x94)
#define KEYC_UP (KEYC_OFFSET + 0x95)
#define KEYC_MOUSE (KEYC_OFFSET + 0x96)
/* Output codes. */
#define TTY_CHARACTER 0
@ -675,8 +682,11 @@ struct tty {
#define TTY_NOCURSOR 0x1
#define TTY_FREEZE 0x2
#define TTY_ESCAPE 0x4
int flags;
struct timespec key_timer;
size_t ksize; /* maximum key size */
RB_HEAD(tty_keys, tty_key) ktree;
};

View File

@ -1,4 +1,4 @@
/* $Id: tty-keys.c,v 1.4 2008-06-23 16:58:49 nicm Exp $ */
/* $Id: tty-keys.c,v 1.5 2008-06-25 07:30:08 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -19,6 +19,7 @@
#include <sys/types.h>
#include <string.h>
#include <time.h>
#include "tmux.h"
@ -181,6 +182,8 @@ struct {
RB_GENERATE(tty_keys, tty_key, entry, tty_keys_cmp);
struct tty_key *tty_keys_find(struct tty *, char *, size_t, size_t *);
int
tty_keys_cmp(struct tty_key *k1, struct tty_key *k2)
{
@ -212,7 +215,8 @@ tty_keys_init(struct tty *tty)
tty->ksize = strlen(tk->string);
RB_INSERT(tty_keys, &tty->ktree, tk);
log_debug("found key %d: size now %zu", tk->code, tty->ksize);
log_debug("found key %x: size now %zu (%s)",
tk->code, tty->ksize, tk->string);
}
}
@ -229,51 +233,107 @@ tty_keys_free(struct tty *tty)
}
}
struct tty_key *
tty_keys_find(struct tty *tty, char *buf, size_t len, size_t *size)
{
struct tty_key *tk, tl;
char *s;
if (len == 0)
return (NULL);
s = xmalloc(tty->ksize + 1);
for (*size = tty->ksize; (*size) > 0; (*size)--) {
if ((*size) > len)
continue;
memcpy(s, buf, *size);
s[*size] = '\0';
log_debug2("looking for key: %s", s);
tl.string = s;
tk = RB_FIND(tty_keys, &tty->ktree, &tl);
if (tk != NULL)
return (tk);
}
xfree(s);
return (NULL);
}
int
tty_keys_next(struct tty *tty, int *code)
{
struct tty_key *tk, tl;
struct tty_key *tk;
size_t size;
char *s;
struct timespec ts;
if (BUFFER_USED(tty->in) == 0)
size = BUFFER_USED(tty->in);
if (size == 0)
return (1);
log_debug("keys have %zu bytes", BUFFER_USED(tty->in));
log_debug("keys are %zu (%.*s)", size, (int) size, BUFFER_OUT(tty->in));
/* If a normal key, return it. */
if (*BUFFER_OUT(tty->in) != '\033') {
*code = buffer_read8(tty->in);
return (0);
}
tk = NULL;
s = xmalloc(tty->ksize + 1);
for (size = tty->ksize; size > 0; size--) {
if (size >= BUFFER_USED(tty->in))
continue;
memcpy(s, BUFFER_OUT(tty->in) + 1, size);
s[size] = '\0';
/* Look for matching key string and return if found. */
tk = tty_keys_find(tty, BUFFER_OUT(tty->in) + 1, size - 1, &size);
if (tk != NULL) {
*code = tk->code;
buffer_remove(tty->in, size + 1);
tl.string = s;
tk = RB_FIND(tty_keys, &tty->ktree, &tl);
if (tk != NULL)
break;
}
xfree(s);
if (tk == NULL) {
size = tty->ksize;
if (size > BUFFER_USED(tty->in))
size = BUFFER_USED(tty->in);
log_debug(
"unmatched key: %.*s", (int) size, BUFFER_OUT(tty->in));
/*
* XXX Pass through unchanged.
*/
*code = '\033';
buffer_remove(tty->in, 1);
tty->flags &= ~TTY_ESCAPE;
return (0);
}
buffer_remove(tty->in, size + 1);
*code = tk->code;
/* Escape but no key string. If the timer isn't started, start it. */
if (!(tty->flags & TTY_ESCAPE)) {
ts.tv_sec = 0;
ts.tv_nsec = 500 * 1000000L;
if (clock_gettime(CLOCK_REALTIME, &tty->key_timer) != 0)
fatal("clock_gettime");
timespecadd(&tty->key_timer, &ts, &tty->key_timer);
tty->flags |= TTY_ESCAPE;
return (1);
}
/* Otherwise, if the timer hasn't expired, wait. */
if (clock_gettime(CLOCK_REALTIME, &ts) != 0)
fatal("clock_gettime");
if (!timespeccmp(&tty->key_timer, &ts, >))
return (1);
tty->flags &= ~TTY_ESCAPE;
/* Remove the leading escape. */
buffer_remove(tty->in, 1);
size = BUFFER_USED(tty->in);
/* If we have no following data, return escape. */
if (size == 0) {
*code = '\033';
return (0);
}
/* If a normal key follows, return it. */
if (*BUFFER_OUT(tty->in) != '\033') {
*code = KEYC_ADDESCAPE(buffer_read8(tty->in));
return (0);
}
/* Try to look up the key. */
tk = tty_keys_find(tty, BUFFER_OUT(tty->in) + 1, size - 1, &size);
if (tk != NULL) {
*code = KEYC_ADDESCAPE(tk->code);
buffer_remove(tty->in, size + 1);
return (0);
}
/* If not found, return escape-escape. */
*code = KEYC_ADDESCAPE('\033');
buffer_remove(tty->in, 1);
return (0);
}

View File

@ -1,4 +1,4 @@
/* $Id: window-copy.c,v 1.23 2008-06-24 07:00:39 nicm Exp $ */
/* $Id: window-copy.c,v 1.24 2008-06-25 07:30:08 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -201,11 +201,13 @@ window_copy_key(struct window *w, struct client *c, int key)
window_copy_cursor_end_of_line(w);
break;
case 'w':
case '\016': /* C-n */
case KEYC_ADDESCAPE('F'): /* M-F */
case KEYC_ADDESCAPE('f'): /* M-f */
window_copy_cursor_next_word(w);
break;
case 'b':
case '\002': /* C-b */
case KEYC_ADDESCAPE('B'): /* M-B */
case KEYC_ADDESCAPE('b'): /* M-b */
window_copy_cursor_previous_word(w);
break;
}