From 504573a0de604bfeb04d4fe938fca8f42da55eca Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 7 Feb 2022 22:54:17 -0800 Subject: move most Teliva menus to the right The problem I'm running into is that apps might want to perform their own editing. So I can't take up prime estate like the ctrl-e hotkey or a menu name of 'edit'. I'm still prioritizing rendering Teliva's edit and permissions menu. If the window is too narrow the app's settings will be overwritten and Teliva's hotkeys will be preferentially displayed. Seems safer. --- src/lcurses/window.c | 2 +- src/teliva.c | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/lcurses/window.c b/src/lcurses/window.c index beaa148..4ce8bb7 100644 --- a/src/lcurses/window.c +++ b/src/lcurses/window.c @@ -1321,7 +1321,7 @@ Wgetch(lua_State *L) unlink("teliva_editor_state"); exit(0); } - if (c == CTRL_E) + if (c == CTRL_U) developer_mode(L); if (c == CTRL_P) permissions_mode(L); diff --git a/src/teliva.c b/src/teliva.c index c21e4af..fd8d105 100644 --- a/src/teliva.c +++ b/src/teliva.c @@ -68,8 +68,6 @@ static void draw_menu(lua_State* L) { mvaddch(LINES-1, x, ' '); menu_column = 2; draw_menu_item("^x", "exit"); - draw_menu_item("^e", "edit"); - draw_menu_item("^p", "perms"); /* if app ran successfully, render any app-specific items */ if (Previous_message == NULL) { @@ -96,7 +94,13 @@ static void draw_menu(lua_State* L) { attroff(COLOR_PAIR(COLOR_PAIR_ERROR)); } - /* render app permissions on the right */ + /* render stuff common to all apps on the right */ + menu_column = COLS-37; + draw_menu_item("^u", "edit app"); + draw_menu_item("^p", "perms"); + + attrset(A_NORMAL); + mvaddstr(LINES-1, COLS-12, ""); render_permissions(L); attrset(A_NORMAL); @@ -110,8 +114,6 @@ const char* character_name(char c) { } static void render_permissions(lua_State* L) { - attrset(A_NORMAL); - mvaddstr(LINES-1, COLS-12, ""); int file_colors = COLOR_PAIR_SAFE; if (file_operations_predicate_body && strcmp("return false", trim(file_operations_predicate_body)) != 0) file_colors = COLOR_PAIR_WARN; -- cgit 1.4.1-2-gfad0