about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-12-03 19:12:57 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-12-03 19:45:51 -0800
commitbbab1a7c1085f1b1a80ff7e0e29e917397496572 (patch)
tree96a07d0724213ebf59c574eda6311d3baa335cf3 /src
parentfe5f54299123fda8760ae8d40761ac0ffb8d908b (diff)
downloadteliva-bbab1a7c1085f1b1a80ff7e0e29e917397496572.tar.gz
get rid of `Esc` hotkey
For a variety of historical reasons, terminals pause every time you
press `Esc`. Let's get rid of that lag.
Diffstat (limited to 'src')
-rw-r--r--src/kilo.c10
-rw-r--r--src/lua.c8
-rw-r--r--src/teliva.h1
3 files changed, 9 insertions, 10 deletions
diff --git a/src/kilo.c b/src/kilo.c
index 991075b..ffe3da8 100644
--- a/src/kilo.c
+++ b/src/kilo.c
@@ -687,7 +687,7 @@ static void editorFindMenu(void) {
     attrset(A_NORMAL);
     extern int menu_column;
     menu_column = 2;
-    draw_menu_item("Esc", "cancel");
+    draw_menu_item("^x", "cancel");
     draw_menu_item("Enter", "submit");
     draw_menu_item("^h", "back up cursor");
     draw_menu_item("^u", "clear");
@@ -713,7 +713,7 @@ static void editorGoMenu(void) {
     attrset(A_NORMAL);
     extern int menu_column;
     menu_column = 2;
-    draw_menu_item("Esc", "cancel");
+    draw_menu_item("^x", "cancel");
     draw_menu_item("Enter", "submit");
     draw_menu_item("^h", "back up cursor");
     draw_menu_item("^u", "clear");
@@ -837,8 +837,8 @@ static void editorFind() {
         if (c == KEY_BACKSPACE || c == DELETE || c == CTRL_H) {
             if (qlen != 0) query[--qlen] = '\0';
             last_match = -1;
-        } else if (c == ESC || c == ENTER) {
-            if (c == ESC) {
+        } else if (c == CTRL_X || c == ENTER) {
+            if (c == CTRL_X) {
                 E.cx = saved_cx; E.cy = saved_cy;
                 E.coloff = saved_coloff; E.rowoff = saved_rowoff;
             }
@@ -1039,7 +1039,7 @@ static void editorGo(lua_State* L) {
         int c = getch();
         if (c == KEY_BACKSPACE || c == DELETE || c == CTRL_H) {
             if (qlen != 0) query[--qlen] = '\0';
-        } else if (c == ESC || c == ENTER) {
+        } else if (c == CTRL_X || c == ENTER) {
             editorSetStatusMessage("");
             if (c == ENTER) {
               save_to_current_definition_and_editor_buffer(L, query);
diff --git a/src/lua.c b/src/lua.c
index dceac8f..246b7fe 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -442,7 +442,7 @@ static void recent_changes_menu (int cursor, int history_array_size) {
   attrset(A_NORMAL);
   extern int menu_column;
   menu_column = 2;
-  draw_menu_item("Esc", "go back");
+  draw_menu_item("^x", "go back");
   /* draw_menu_item("↓/space", "older"); */
   attroff(A_REVERSE);
   mvaddstr(LINES-1, menu_column, " ↓/space ");
@@ -608,7 +608,7 @@ void recent_changes_view (lua_State *L) {
     render_recent_changes(L, history_array, cursor, history_array_size);
     int c = getch();
     switch (c) {
-      case ESC:
+      case CTRL_X:
         quit = 1;
         break;
       case KEY_DOWN:
@@ -649,7 +649,7 @@ static void big_picture_menu (void) {
   attrset(A_NORMAL);
   extern int menu_column;
   menu_column = 2;
-  draw_menu_item("Esc", "go back");
+  draw_menu_item("^x", "go back");
   draw_menu_item("Enter", "submit");
   draw_menu_item("^h", "back up cursor");
   draw_menu_item("^u", "clear");
@@ -816,7 +816,7 @@ restart:
     int c = getch();
     if (c == KEY_BACKSPACE || c == DELETE || c == CTRL_H) {
       if (qlen != 0) query[--qlen] = '\0';
-    } else if (c == ESC) {
+    } else if (c == CTRL_X) {
       return;
     } else if (c == ENTER) {
       save_to_current_definition_and_editor_buffer(L, query);
diff --git a/src/teliva.h b/src/teliva.h
index fdee063..0f78bde 100644
--- a/src/teliva.h
+++ b/src/teliva.h
@@ -20,7 +20,6 @@ enum KEY_ACTION {
   CTRL_S = 19,
   CTRL_U = 21,
   CTRL_X = 24,
-  ESC = 27,
   CTRL_SLASH = 31,
   DELETE = 127,
 };