about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-02-07 22:54:17 -0800
committerKartik K. Agaram <vc@akkartik.com>2022-02-07 22:54:17 -0800
commit504573a0de604bfeb04d4fe938fca8f42da55eca (patch)
tree896786f542ee92007703561875aa2be516f2a27f /src
parent0d16c7c690c0608630082a0470c500d9b3f25f8a (diff)
downloadteliva-504573a0de604bfeb04d4fe938fca8f42da55eca.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/lcurses/window.c2
-rw-r--r--src/teliva.c12
2 files changed, 8 insertions, 6 deletions
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;