weechat-hashes
C. McEnroe 2020-02-09 03:45:44 -05:00
parent e6e2021d48
commit 282de9af30
3 changed files with 6 additions and 2 deletions

1
chat.h
View File

@ -151,6 +151,7 @@ enum Edit {
EditRight, EditRight,
EditKill, EditKill,
EditErase, EditErase,
EditDelete,
EditInsert, EditInsert,
EditComplete, EditComplete,
EditEnter, EditEnter,

5
edit.c
View File

@ -138,8 +138,9 @@ void edit(size_t id, enum Edit op, wchar_t ch) {
break; case EditLeft: if (pos) pos--; break; case EditLeft: if (pos) pos--;
break; case EditRight: if (pos < len) pos++; break; case EditRight: if (pos < len) pos++;
break; case EditKill: len = pos = 0; break; case EditKill: len = pos = 0;
break; case EditErase: if (pos) delete(--pos, 1); break; case EditErase: if (pos) delete(--pos, 1);
break; case EditDelete: delete(pos, 1);
break; case EditInsert: { break; case EditInsert: {
reserve(pos, 1); reserve(pos, 1);

2
ui.c
View File

@ -625,6 +625,7 @@ static void keyCode(int code) {
break; case KeyMetaM: waddch(windows.active->pad, '\n'); break; case KeyMetaM: waddch(windows.active->pad, '\n');
break; case KEY_BACKSPACE: edit(id, EditErase, 0); 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_END: edit(id, EditEnd, 0);
break; case KEY_ENTER: edit(id, EditEnter, 0); break; case KEY_ENTER: edit(id, EditEnter, 0);
break; case KEY_HOME: edit(id, EditHome, 0); break; case KEY_HOME: edit(id, EditHome, 0);
@ -645,6 +646,7 @@ static void keyCtrl(wchar_t ch) {
break; case L'?': edit(id, EditErase, 0); break; case L'?': edit(id, EditErase, 0);
break; case L'A': edit(id, EditHome, 0); break; case L'A': edit(id, EditHome, 0);
break; case L'B': edit(id, EditLeft, 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'E': edit(id, EditEnd, 0);
break; case L'F': edit(id, EditRight, 0); break; case L'F': edit(id, EditRight, 0);
break; case L'H': edit(id, EditErase, 0); break; case L'H': edit(id, EditErase, 0);