about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/kilo.c10
-rw-r--r--src/lua.c11
-rw-r--r--src/teliva.h12
3 files changed, 15 insertions, 18 deletions
diff --git a/src/kilo.c b/src/kilo.c
index 6df16e5..4035f60 100644
--- a/src/kilo.c
+++ b/src/kilo.c
@@ -674,6 +674,8 @@ static void editorMenu(void) {
     draw_menu_item("^b", "big picture");
     draw_menu_item("^f", "find");
     draw_menu_item("^/", "(un)comment line");
+    draw_menu_item("^h", "back up cursor");
+    draw_menu_item("^l", "end of line");
     attrset(A_NORMAL);
 }
 
@@ -830,7 +832,7 @@ static void editorFind() {
         mvprintw(LINES-2, 0, "Find: %s", query);
 
         int c = getch();
-        if (c == TELIVA_BACKSPACE) {
+        if (c == KEY_BACKSPACE || c == DELETE || c == CTRL_H) {
             if (qlen != 0) query[--qlen] = '\0';
             last_match = -1;
         } else if (c == ESC || c == ENTER) {
@@ -1033,7 +1035,7 @@ static void editorGo(lua_State* L) {
         mvprintw(LINES-2, 0, "Go to: %s", query);
 
         int c = getch();
-        if (c == TELIVA_BACKSPACE) {
+        if (c == KEY_BACKSPACE || c == DELETE || c == CTRL_H) {
             if (qlen != 0) query[--qlen] = '\0';
         } else if (c == ESC || c == ENTER) {
             editorSetStatusMessage("");
@@ -1095,7 +1097,9 @@ static void editorProcessKeypress(lua_State* L) {
     case CTRL_F:
         editorFind();
         break;
-    case TELIVA_BACKSPACE:
+    case KEY_BACKSPACE:
+    case DELETE:
+    case CTRL_H:
         editorDelChar();
         break;
     case KEY_NPAGE:
diff --git a/src/lua.c b/src/lua.c
index 66eddbf..dceac8f 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -451,8 +451,8 @@ static void recent_changes_menu (int cursor, int history_array_size) {
   draw_string_on_menu("older");
   /* draw_menu_item("↑/backspace", "newer"); */
   attroff(A_REVERSE);
-  mvaddstr(LINES-1, menu_column, " ↑/" TELIVA_BACKSPACE_KEY_NAME " ");
-  menu_column += (strlen(TELIVA_BACKSPACE_KEY_NAME) + 4);
+  mvaddstr(LINES-1, menu_column, " ↑/backspace/delete/^h ");
+  menu_column += 23;
   attron(A_REVERSE);
   draw_string_on_menu("newer");
   draw_menu_item("^e", "edit/add note");
@@ -616,7 +616,9 @@ void recent_changes_view (lua_State *L) {
         if (cursor > 1) --cursor;
         break;
       case KEY_UP:
-      case TELIVA_BACKSPACE:
+      case KEY_BACKSPACE:
+      case DELETE:
+      case CTRL_H:
         if (cursor < history_array_size) ++cursor;
         break;
       case CTRL_E:
@@ -649,6 +651,7 @@ static void big_picture_menu (void) {
   menu_column = 2;
   draw_menu_item("Esc", "go back");
   draw_menu_item("Enter", "submit");
+  draw_menu_item("^h", "back up cursor");
   draw_menu_item("^u", "clear");
   draw_menu_item("^r", "recent changes");
   attrset(A_NORMAL);
@@ -811,7 +814,7 @@ restart:
       mvaddch(LINES-2, x, ' ');
     mvprintw(LINES-2, 0, "Edit: %s", query);
     int c = getch();
-    if (c == TELIVA_BACKSPACE) {
+    if (c == KEY_BACKSPACE || c == DELETE || c == CTRL_H) {
       if (qlen != 0) query[--qlen] = '\0';
     } else if (c == ESC) {
       return;
diff --git a/src/teliva.h b/src/teliva.h
index 65c1020..fdee063 100644
--- a/src/teliva.h
+++ b/src/teliva.h
@@ -11,11 +11,6 @@ enum KEY_ACTION {
   CTRL_F = 6,
   CTRL_G = 7,
   CTRL_H = 8,
-#if __APPLE__
-  TELIVA_BACKSPACE = 127,  /* delete */
-#else
-  TELIVA_BACKSPACE = KEY_BACKSPACE,
-#endif
   TAB = 9,
   ENTER = 10,
   CTRL_K = 11,
@@ -27,12 +22,7 @@ enum KEY_ACTION {
   CTRL_X = 24,
   ESC = 27,
   CTRL_SLASH = 31,
+  DELETE = 127,
 };
 
-#if __APPLE__
-  #define TELIVA_BACKSPACE_KEY_NAME "delete/backspace"
-#else
-  #define TELIVA_BACKSPACE_KEY_NAME "backspace"
-#endif
-
 #endif