Add M-b and M-f
parent
d7c96fc81b
commit
b08c2d03ef
|
@ -211,6 +211,10 @@ Move right.
|
|||
Delete to end of line.
|
||||
.It Ic C-u
|
||||
Delete to beginning of line.
|
||||
.It Ic M-b
|
||||
Move to previous word.
|
||||
.It Ic M-f
|
||||
Move to next word.
|
||||
.El
|
||||
.
|
||||
.Ss Window Keys
|
||||
|
|
2
chat.h
2
chat.h
|
@ -149,6 +149,8 @@ enum Edit {
|
|||
EditTail,
|
||||
EditPrev,
|
||||
EditNext,
|
||||
EditPrevWord,
|
||||
EditNextWord,
|
||||
EditKillPrev,
|
||||
EditKillNext,
|
||||
EditDeletePrev,
|
||||
|
|
8
edit.c
8
edit.c
|
@ -137,6 +137,14 @@ void edit(size_t id, enum Edit op, wchar_t ch) {
|
|||
break; case EditTail: pos = len;
|
||||
break; case EditPrev: if (pos) pos--;
|
||||
break; case EditNext: if (pos < len) pos++;
|
||||
break; case EditPrevWord: {
|
||||
if (pos) pos--;
|
||||
while (pos && buf[pos - 1] != L' ') pos--;
|
||||
}
|
||||
break; case EditNextWord: {
|
||||
if (pos < len) pos++;
|
||||
while (pos < len && buf[pos] != L' ') pos++;
|
||||
}
|
||||
|
||||
break; case EditDeletePrev: if (pos) delete(--pos, 1);
|
||||
break; case EditDeleteNext: delete(pos, 1);
|
||||
|
|
4
ui.c
4
ui.c
|
@ -192,6 +192,8 @@ static void errExit(void) {
|
|||
X(KeyMeta7, "\0337") \
|
||||
X(KeyMeta8, "\0338") \
|
||||
X(KeyMeta9, "\0339") \
|
||||
X(KeyMetaB, "\033b") \
|
||||
X(KeyMetaF, "\033f") \
|
||||
X(KeyMetaM, "\33m") \
|
||||
X(KeyFocusIn, "\33[I") \
|
||||
X(KeyFocusOut, "\33[O") \
|
||||
|
@ -622,6 +624,8 @@ static void keyCode(int code) {
|
|||
break; case KeyPasteOn:; // TODO
|
||||
break; case KeyPasteOff:; // TODO
|
||||
|
||||
break; case KeyMetaB: edit(id, EditPrevWord, 0);
|
||||
break; case KeyMetaF: edit(id, EditNextWord, 0);
|
||||
break; case KeyMetaM: waddch(windows.active->pad, '\n');
|
||||
|
||||
break; case KEY_BACKSPACE: edit(id, EditDeletePrev, 0);
|
||||
|
|
Loading…
Reference in New Issue