diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-01-02 16:41:23 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-01-02 16:48:00 -0800 |
commit | 30a1fb202e6a34b7acc82b1397cebf755b1c4e6d (patch) | |
tree | 0126c5a3a7cba0c55e04d2b296cb61043b468668 /src | |
parent | 18a499c5c0d7e01a5fd797e719aaf6459cd15244 (diff) | |
download | teliva-30a1fb202e6a34b7acc82b1397cebf755b1c4e6d.tar.gz |
start peeling out an editor for non-code
Diffstat (limited to 'src')
-rw-r--r-- | src/kilo.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/kilo.c b/src/kilo.c index 5eef4aa..087adf6 100644 --- a/src/kilo.c +++ b/src/kilo.c @@ -1068,10 +1068,7 @@ static void editorGo(lua_State* L) { * is typing stuff on the terminal. */ static int Quit = 0; static int Back_to_big_picture = 0; -static void editorProcessKeypress(lua_State* L) { - int c = getch(); -//? mvprintw(LINES-3, 60, "key: %d\n", c); -//? getch(); +static void editorProcessKeypress2(int c) { switch(c) { case ENTER: { @@ -1092,16 +1089,6 @@ static void editorProcessKeypress(lua_State* L) { save_editor_state(E.rowoff, E.coloff, E.cy, E.cx); Quit = 1; break; - case CTRL_G: - /* Go to a different definition. */ - editorGo(L); - break; - case CTRL_B: - /* Go to big-picture view. */ - editorSaveToDisk(); - Quit = 1; - Back_to_big_picture = 1; - break; case CTRL_F: editorFind(); break; @@ -1173,6 +1160,26 @@ static void editorProcessKeypress(lua_State* L) { } } +static void editorProcessKeypress(lua_State* L) { + int c = getch(); +//? mvprintw(LINES-3, 60, "key: %d\n", c); +//? getch(); + switch(c) { + case CTRL_G: + /* Go to a different definition. */ + editorGo(L); + break; + case CTRL_B: + /* Go to big-picture view. */ + editorSaveToDisk(); + Quit = 1; + Back_to_big_picture = 1; + break; + default: + editorProcessKeypress2(c); + } +} + static void initEditor(void) { E.cx = 0; E.cy = 0; |