parent
282de9af30
commit
d7c96fc81b
|
@ -201,12 +201,16 @@ Switch to window by number.
|
|||
Move to beginning of line.
|
||||
.It Ic C-b
|
||||
Move left.
|
||||
.It Ic C-d
|
||||
Delete next character.
|
||||
.It Ic C-e
|
||||
Move to end of line.
|
||||
.It Ic C-f
|
||||
Move right.
|
||||
.It Ic C-k
|
||||
Delete to end of line.
|
||||
.It Ic C-u
|
||||
Delete line.
|
||||
Delete to beginning of line.
|
||||
.El
|
||||
.
|
||||
.Ss Window Keys
|
||||
|
|
15
chat.h
15
chat.h
|
@ -145,13 +145,14 @@ void uiFormat(
|
|||
) __attribute__((format(printf, 4, 5)));
|
||||
|
||||
enum Edit {
|
||||
EditHome,
|
||||
EditEnd,
|
||||
EditLeft,
|
||||
EditRight,
|
||||
EditKill,
|
||||
EditErase,
|
||||
EditDelete,
|
||||
EditHead,
|
||||
EditTail,
|
||||
EditPrev,
|
||||
EditNext,
|
||||
EditKillPrev,
|
||||
EditKillNext,
|
||||
EditDeletePrev,
|
||||
EditDeleteNext,
|
||||
EditInsert,
|
||||
EditComplete,
|
||||
EditEnter,
|
||||
|
|
15
edit.c
15
edit.c
|
@ -133,14 +133,15 @@ static void tabReject(void) {
|
|||
void edit(size_t id, enum Edit op, wchar_t ch) {
|
||||
size_t init = pos;
|
||||
switch (op) {
|
||||
break; case EditHome: pos = 0;
|
||||
break; case EditEnd: pos = len;
|
||||
break; case EditLeft: if (pos) pos--;
|
||||
break; case EditRight: if (pos < len) pos++;
|
||||
break; case EditHead: pos = 0;
|
||||
break; case EditTail: pos = len;
|
||||
break; case EditPrev: if (pos) pos--;
|
||||
break; case EditNext: if (pos < len) pos++;
|
||||
|
||||
break; case EditKill: len = pos = 0;
|
||||
break; case EditErase: if (pos) delete(--pos, 1);
|
||||
break; case EditDelete: delete(pos, 1);
|
||||
break; case EditDeletePrev: if (pos) delete(--pos, 1);
|
||||
break; case EditDeleteNext: delete(pos, 1);
|
||||
break; case EditKillPrev: delete(0, pos); pos = 0;
|
||||
break; case EditKillNext: delete(pos, len - pos);
|
||||
|
||||
break; case EditInsert: {
|
||||
reserve(pos, 1);
|
||||
|
|
29
ui.c
29
ui.c
|
@ -624,13 +624,13 @@ static void keyCode(int code) {
|
|||
|
||||
break; case KeyMetaM: waddch(windows.active->pad, '\n');
|
||||
|
||||
break; case KEY_BACKSPACE: edit(id, EditErase, 0);
|
||||
break; case KEY_DC: edit(id, EditDelete, 0);
|
||||
break; case KEY_END: edit(id, EditEnd, 0);
|
||||
break; case KEY_BACKSPACE: edit(id, EditDeletePrev, 0);
|
||||
break; case KEY_DC: edit(id, EditDeleteNext, 0);
|
||||
break; case KEY_END: edit(id, EditTail, 0);
|
||||
break; case KEY_ENTER: edit(id, EditEnter, 0);
|
||||
break; case KEY_HOME: edit(id, EditHome, 0);
|
||||
break; case KEY_LEFT: edit(id, EditLeft, 0);
|
||||
break; case KEY_RIGHT: edit(id, EditRight, 0);
|
||||
break; case KEY_HOME: edit(id, EditHead, 0);
|
||||
break; case KEY_LEFT: edit(id, EditPrev, 0);
|
||||
break; case KEY_RIGHT: edit(id, EditNext, 0);
|
||||
|
||||
break; default: {
|
||||
if (code >= KeyMeta0 && code <= KeyMeta9) {
|
||||
|
@ -643,17 +643,18 @@ static void keyCode(int code) {
|
|||
static void keyCtrl(wchar_t ch) {
|
||||
size_t id = windows.active->id;
|
||||
switch (ch ^ L'@') {
|
||||
break; case L'?': edit(id, EditErase, 0);
|
||||
break; case L'A': edit(id, EditHome, 0);
|
||||
break; case L'B': edit(id, EditLeft, 0);
|
||||
break; case L'D': edit(id, EditDelete, 0);
|
||||
break; case L'E': edit(id, EditEnd, 0);
|
||||
break; case L'F': edit(id, EditRight, 0);
|
||||
break; case L'H': edit(id, EditErase, 0);
|
||||
break; case L'?': edit(id, EditDeletePrev, 0);
|
||||
break; case L'A': edit(id, EditHead, 0);
|
||||
break; case L'B': edit(id, EditPrev, 0);
|
||||
break; case L'D': edit(id, EditDeleteNext, 0);
|
||||
break; case L'E': edit(id, EditTail, 0);
|
||||
break; case L'F': edit(id, EditNext, 0);
|
||||
break; case L'H': edit(id, EditDeletePrev, 0);
|
||||
break; case L'I': edit(id, EditComplete, 0);
|
||||
break; case L'J': edit(id, EditEnter, 0);
|
||||
break; case L'K': edit(id, EditKillNext, 0);
|
||||
break; case L'L': clearok(curscr, true);
|
||||
break; case L'U': edit(id, EditKill, 0);
|
||||
break; case L'U': edit(id, EditKillPrev, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue