about summary refs log tree commit diff stats
path: root/src/layout
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-01-19 15:26:41 +0100
committerbptato <nincsnevem662@gmail.com>2023-01-19 15:26:41 +0100
commit5c10df5ea14305bd6da238bd56a10192f4a06fea (patch)
treeebbfc70e95d541f98aed9e20ebfdf3563bd84384 /src/layout
parent4ec160f63168fc385e9021ba376162de4f050234 (diff)
downloadchawan-5c10df5ea14305bd6da238bd56a10192f4a06fea.tar.gz
layout/engine: fix tab display
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/engine.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index 47c293b6..8a30b7e6 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -337,11 +337,14 @@ proc processWhitespace(state: var InlineState, c: char) =
     else:
       state.ictx.whitespacenum = max(state.ictx.whitespacenum, 1)
   of WHITESPACE_PRE, WHITESPACE_PRE_WRAP:
+    #TODO whitespace type should be preserved here. (it isn't, because
+    # it would break tabs in the current buffer model.)
     if c == '\n':
       state.ictx.flushLine(state.computed)
     elif c == '\t':
+      let prev = state.ictx.charwidth
       state.ictx.charwidth = ((state.ictx.charwidth div 8) + 1) * 8
-      state.word.str &= c
+      state.ictx.whitespacenum += state.ictx.charwidth - prev
     else:
       inc state.ictx.whitespacenum