about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-11-28 08:50:44 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-11-28 08:50:47 -0800
commit1ac98e28e69d6a1cd7fa1468e69e8b2594ccbc6d (patch)
treec9301d4dbd4271d2f6f1af0b0d31ec35bdc3c33c /src
parent75ded7a9187ebd588f6ef0a99a48dff726179ed6 (diff)
downloadteliva-1ac98e28e69d6a1cd7fa1468e69e8b2594ccbc6d.tar.gz
fix backspace on Mac
I'm deliberately restricting this incompatibility to the editor
environment for now.
Diffstat (limited to 'src')
-rw-r--r--src/kilo.c2
-rw-r--r--src/teliva.h5
2 files changed, 6 insertions, 1 deletions
diff --git a/src/kilo.c b/src/kilo.c
index dc40fb0..b2f9a18 100644
--- a/src/kilo.c
+++ b/src/kilo.c
@@ -810,7 +810,7 @@ static void editorFind() {
         mvprintw(LINES-2, 0, "Find: %s", query);
 
         int c = getch();
-        if (c == KEY_BACKSPACE) {
+        if (c == TELIVA_BACKSPACE) {
             if (qlen != 0) query[--qlen] = '\0';
             last_match = -1;
         } else if (c == ESC || c == ENTER) {
diff --git a/src/teliva.h b/src/teliva.h
index 9a6038e..bd2d43c 100644
--- a/src/teliva.h
+++ b/src/teliva.h
@@ -11,6 +11,11 @@ enum KEY_ACTION {
   CTRL_F = 6,
   CTRL_G = 7,
   CTRL_H = 8,
+#if APPLE
+  TELIVA_BACKSPACE = KEY_DELETE,
+#else
+  TELIVA_BACKSPACE = KEY_BACKSPACE,
+#endif
   TAB = 9,
   ENTER = 10,
   CTRL_L = 12,