about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-01-02 22:51:27 -0800
committerKartik K. Agaram <vc@akkartik.com>2022-01-02 22:51:27 -0800
commitbe0c9362767ee4b2a46d6bbe6315f9b6015b5241 (patch)
tree0d71fee9ba911f7465c65e40f2cccdb63d88631d
parente3cef7ee5686d335202c73b5316c2b1f74151cfc (diff)
downloadteliva-be0c9362767ee4b2a46d6bbe6315f9b6015b5241.tar.gz
error handling when editing file permissions
Still highly non-ideal. Lua is a dynamic language, and has low ability
to detect syntax errors within functions.

Perhaps I should run a test call after every edit.
-rw-r--r--src/kilo.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/kilo.c b/src/kilo.c
index 4ab584b..3864acd 100644
--- a/src/kilo.c
+++ b/src/kilo.c
@@ -1331,7 +1331,27 @@ void resumeNonCodeEdit() {
         E.cols = COLS-LINE_NUMBER_SPACE;
         E.startrow = CALLERS_SPACE;
         E.endrow = LINES-MENU_SPACE;
-        editorRefreshScreen(editorMenu);
+        editorRefreshScreen(editorNonCodeMenu);
+        int c = getch();
+        editorProcessKeypress2(c);
+    }
+}
+
+void resumeNonCodeEdit2() {
+    Quit = 0;
+    Back_to_big_picture = 0;
+    E.startcol = LINE_NUMBER_SPACE;
+    E.startrow = 1;  /* space for function header */
+    E.endrow = 10;  /* nudge people to keep function short */
+    while(!Quit) {
+        /* update on resize */
+        E.cols = COLS-LINE_NUMBER_SPACE;
+        editorRefreshScreen(editorNonCodeMenu);
+        int y, x;
+        getyx(stdscr, y, x);
+        mvaddstr(0, 0, "function file_operation_permitted(filename, mode)");
+        mvaddstr(E.startrow + E.numrows - E.rowoff, 0, "end");
+        mvaddstr(y, x, "");
         int c = getch();
         editorProcessKeypress2(c);
     }