about summary refs log tree commit diff stats
path: root/shell/gap-buffer.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-04-25 21:03:14 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-04-25 21:03:14 -0700
commit6bb70a236c759d3d85265de068cde6d26a747d3b (patch)
tree29cd8a7e1fdcc0c755fb2b742362d55440fba9af /shell/gap-buffer.mu
parentcbebd548ca002c9c0899731898206e8afa157e59 (diff)
downloadmu-6bb70a236c759d3d85265de068cde6d26a747d3b.tar.gz
shell: tab inserts two spaces
Diffstat (limited to 'shell/gap-buffer.mu')
-rw-r--r--shell/gap-buffer.mu8
1 files changed, 8 insertions, 0 deletions
diff --git a/shell/gap-buffer.mu b/shell/gap-buffer.mu
index 6486b6ea..893dc176 100644
--- a/shell/gap-buffer.mu
+++ b/shell/gap-buffer.mu
@@ -971,6 +971,14 @@ fn edit-gap-buffer self: (addr gap-buffer), key: grapheme {
     clear-gap-buffer self
     return
   }
+  {
+    compare g, 9/tab
+    break-if-!=
+    # tab = 2 spaces
+    add-code-point-at-gap self, 0x20/space
+    add-code-point-at-gap self, 0x20/space
+    return
+  }
   # default: insert character
   add-grapheme-at-gap self, g
 }