:: commit 193e5948d4b919ac3a1019c6de6634edfcc77bf4

mintsuki <mintsuki@protonmail.com> — 2024-08-05 17:34

parents: 9ac63ddd6a

menu/editor: Accept and insert tabs from keyboard input

diff --git a/common/lib/getchar.c b/common/lib/getchar.c
index 014d9a95..8a611718 100644
--- a/common/lib/getchar.c
+++ b/common/lib/getchar.c
@@ -78,6 +78,8 @@ int getchar_internal(uint8_t scancode, uint8_t ascii, uint32_t shift_state) {
             return '\n';
         case '\b':
             return '\b';
+        case '\t':
+            return '\t';
     }
 
     if (shift_state & (GETCHAR_LCTRL | GETCHAR_RCTRL)) {
diff --git a/common/menu.c b/common/menu.c
index 2792cf26..0fef4ce8 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -488,7 +488,7 @@ refresh:
             return NULL;
         default:
             if (buffer_len < EDITOR_MAX_BUFFER_SIZE - 1) {
-                if (isprint(c) || c == '\n') {
+                if (isprint(c) || c == '\n' || c == '\t') {
                     for (size_t i = buffer_len; ; i--) {
                         buffer[i+1] = buffer[i];
                         if (i == cursor_offset)
tab: 248 wrap: offon