diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-11-06 10:06:19 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-11-06 10:12:50 -0700 |
commit | 567ee60c5a53d4eb0f96a77a30cb53ac13bc84f8 (patch) | |
tree | fd63126f99cc815d6d49a97a01b0f6f8e5b0d9af | |
parent | 491f9a378f5d5ea3b47a6d15b83bde0ededa5461 (diff) | |
download | teliva-567ee60c5a53d4eb0f96a77a30cb53ac13bc84f8.tar.gz |
.
-rw-r--r-- | src/kilo.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/kilo.c b/src/kilo.c index 14d7bef..fefa96a 100644 --- a/src/kilo.c +++ b/src/kilo.c @@ -111,19 +111,19 @@ struct editorConfig { static struct editorConfig E; enum KEY_ACTION{ - KEY_NULL = 0, /* NULL */ - CTRL_C = 3, /* Ctrl-c */ - CTRL_D = 4, /* Ctrl-d */ - CTRL_F = 6, /* Ctrl-f */ - CTRL_H = 8, /* Ctrl-h */ - TAB = 9, /* Tab */ - CTRL_L = 12, /* Ctrl+l */ - ENTER = 13, /* Enter */ - CTRL_Q = 17, /* Ctrl-q */ - CTRL_S = 19, /* Ctrl-s */ - CTRL_U = 21, /* Ctrl-u */ - ESC = 27, /* Escape */ - BACKSPACE = 127, /* Backspace */ + KEY_NULL = 0, + CTRL_C = 3, + CTRL_D = 4, + CTRL_F = 6, + CTRL_H = 8, + TAB = 9, + CTRL_L = 12, + ENTER = 13, + CTRL_Q = 17, + CTRL_S = 19, + CTRL_U = 21, + ESC = 27, + BACKSPACE = 127, /* The following are just soft codes, not really reported by the * terminal directly. */ ARROW_LEFT = 1000, @@ -1162,14 +1162,14 @@ void editorProcessKeypress(int fd) { int c = editorReadKey(fd); switch(c) { - case ENTER: /* Enter */ + case ENTER: editorInsertNewline(); break; - case CTRL_C: /* Ctrl-c */ + case CTRL_C: /* We ignore ctrl-c, it can't be so simple to lose the changes * to the edited file. */ break; - case CTRL_Q: /* Ctrl-q */ + case CTRL_Q: /* Quit if the file was already saved. */ if (E.dirty && quit_times) { editorSetStatusMessage("WARNING!!! File has unsaved changes. " @@ -1179,14 +1179,14 @@ void editorProcessKeypress(int fd) { } Quit = 1; break; - case CTRL_S: /* Ctrl-s */ + case CTRL_S: editorSave(); break; case CTRL_F: editorFind(fd); break; - case BACKSPACE: /* Backspace */ - case CTRL_H: /* Ctrl-h */ + case BACKSPACE: + case CTRL_H: case DEL_KEY: editorDelChar(); break; @@ -1210,8 +1210,8 @@ void editorProcessKeypress(int fd) { case ARROW_RIGHT: editorMoveCursor(c); break; - case CTRL_L: /* ctrl+l, clear screen */ - /* Just refresht the line as side effect. */ + case CTRL_L: + /* Just refresh the line as side effect. */ break; case ESC: /* Nothing to do for ESC in this mode. */ |