about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-07-27 17:35:56 +0200
committerbptato <nincsnevem662@gmail.com>2023-07-27 17:35:56 +0200
commit4c0d69b01d20e30439c3e46c19a9af2e633c5681 (patch)
treed9fbd3c6814ffad0cd8539bccc33abe485c21c2a /src
parent1e0506adb18b38fb7b187a4d81e39b8d6a1e23a4 (diff)
downloadchawan-4c0d69b01d20e30439c3e46c19a9af2e633c5681.tar.gz
layout: fix incorrect parentheses
In the tab width case, only whitespacenum was being divided instead of
charwidth + whitespacenum, which resulted in an exponential growth of
both charwidth and whitespacenum.
Diffstat (limited to 'src')
-rw-r--r--src/layout/engine.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index 812c05e8..4fa61dff 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -402,7 +402,7 @@ proc processWhitespace(state: var InlineState, c: char) =
     elif c == '\t':
       let prev = state.ictx.charwidth
       state.ictx.charwidth = ((state.ictx.charwidth +
-        state.ictx.whitespacenum div 8) + 1) * 8 - state.ictx.whitespacenum
+        state.ictx.whitespacenum) div 8 + 1) * 8 - state.ictx.whitespacenum
       state.ictx.whitespacenum += state.ictx.charwidth - prev
     else:
       inc state.ictx.whitespacenum