start peeling out an editor for non-code

This commit is contained in:
Kartik K. Agaram 2022-01-02 16:41:23 -08:00
parent 18a499c5c0
commit 30a1fb202e

View File

@ -1068,10 +1068,7 @@ static void editorGo(lua_State* L) {
* is typing stuff on the terminal. */ * is typing stuff on the terminal. */
static int Quit = 0; static int Quit = 0;
static int Back_to_big_picture = 0; static int Back_to_big_picture = 0;
static void editorProcessKeypress(lua_State* L) { static void editorProcessKeypress2(int c) {
int c = getch();
//? mvprintw(LINES-3, 60, "key: %d\n", c);
//? getch();
switch(c) { switch(c) {
case ENTER: case ENTER:
{ {
@ -1092,16 +1089,6 @@ static void editorProcessKeypress(lua_State* L) {
save_editor_state(E.rowoff, E.coloff, E.cy, E.cx); save_editor_state(E.rowoff, E.coloff, E.cy, E.cx);
Quit = 1; Quit = 1;
break; 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: case CTRL_F:
editorFind(); editorFind();
break; 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) { static void initEditor(void) {
E.cx = 0; E.cx = 0;
E.cy = 0; E.cy = 0;