diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-11-14 08:10:46 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-11-14 09:48:40 -0800 |
commit | 4ab3ccebb58fa3d6b8c39cf671d50ce9680beae0 (patch) | |
tree | 3a532544410ca811e15b454f88d13efe2c3be12f /src | |
parent | af4fbe97bf198b2825a8db634b2feb7ed7c8c6a5 (diff) | |
download | teliva-4ab3ccebb58fa3d6b8c39cf671d50ce9680beae0.tar.gz |
more menu cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/kilo.c | 19 | ||||
-rw-r--r-- | src/lua.c | 5 |
2 files changed, 16 insertions, 8 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; diff --git a/src/lua.c b/src/lua.c index 637b407..ecdf732 100644 --- a/src/lua.c +++ b/src/lua.c @@ -390,6 +390,7 @@ static void browser_menu (void) { menu_column = 2; draw_menu_item("Esc", "go back"); draw_menu_item("Enter", "submit"); + draw_menu_item("^u", "clear"); attrset(A_NORMAL); } @@ -495,6 +496,8 @@ int browse_image (lua_State *L) { int qlen = 0; while (1) { browser_menu(); + for (int x = 0; x < COLS; ++x) + mvaddch(LINES-2, x, ' '); mvprintw(LINES-2, 0, "Edit: %s", query); int c = getch(); if (c == KEY_BACKSPACE) { @@ -505,8 +508,8 @@ int browse_image (lua_State *L) { edit_image(L, query); return 1; } 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; |