about summary refs log tree commit diff stats
path: root/src/kilo.c
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-11-14 08:10:46 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-11-14 09:48:40 -0800
commit4ab3ccebb58fa3d6b8c39cf671d50ce9680beae0 (patch)
tree3a532544410ca811e15b454f88d13efe2c3be12f /src/kilo.c
parentaf4fbe97bf198b2825a8db634b2feb7ed7c8c6a5 (diff)
downloadteliva-4ab3ccebb58fa3d6b8c39cf671d50ce9680beae0.tar.gz
more menu cleanup
Diffstat (limited to 'src/kilo.c')
-rw-r--r--src/kilo.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/kilo.c b/src/kilo.c
index df05165..f446ec8 100644
--- a/src/kilo.c
+++ b/src/kilo.c
@@ -685,16 +685,17 @@ static void editorFindMenu(void) {
     menu_column = 2;
     draw_menu_item("Esc", "cancel");
     draw_menu_item("Enter", "submit");
-    // draw_menu_item("↑", "previous");
+    draw_menu_item("^u", "clear");
+    // draw_menu_item("←/↑", "previous");
     attroff(A_REVERSE);
-    mvaddstr(LINES-1, menu_column, " ↑ ");
-    menu_column += 3;  // strlen isn't sufficient
+    mvaddstr(LINES-1, menu_column, " ←/↑ ");
+    menu_column += 5;  // strlen isn't sufficient
     attron(A_REVERSE);
     draw_string_on_menu("previous");
-    // draw_menu_item("↓", "next");
+    // draw_menu_item("↓/→", "next");
     attroff(A_REVERSE);
-    mvaddstr(LINES-1, menu_column, " ↓ ");
-    menu_column += 3;  // strlen isn't sufficient
+    mvaddstr(LINES-1, menu_column, " ↓/→ ");
+    menu_column += 5;  // strlen isn't sufficient
     attron(A_REVERSE);
     draw_string_on_menu("next");
     attrset(A_NORMAL);
@@ -709,6 +710,7 @@ static void editorGoMenu(void) {
     menu_column = 2;
     draw_menu_item("Esc", "cancel");
     draw_menu_item("Enter", "submit");
+    draw_menu_item("^u", "clear");
     attrset(A_NORMAL);
 }
 
@@ -837,6 +839,9 @@ static void editorFind() {
             FIND_RESTORE_HL;
             editorSetStatusMessage("");
             return;
+        } else if (c == CTRL_U) {
+            qlen = 0;
+            query[qlen] = '\0';
         } else if (c == KEY_RIGHT || c == KEY_DOWN) {
             find_next = 1;
         } else if (c == KEY_LEFT || c == KEY_UP) {
@@ -1027,8 +1032,8 @@ static void editorGo(lua_State* L) {
             }
             return;
         } else if (c == CTRL_U) {
-          query[0] = '\0';
           qlen = 0;
+          query[qlen] = '\0';
         } else if (isprint(c)) {
             if (qlen < CURRENT_DEFINITION_LEN) {
                 query[qlen++] = c;