about summary refs log tree commit diff stats
path: root/src/render/renderdocument.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-07-04 00:25:20 +0200
committerbptato <nincsnevem662@gmail.com>2023-07-04 00:25:20 +0200
commit667ca4188a9e587111ed48bd82ecdab6f1035229 (patch)
tree3a4aac89a4e54b5c2ce689ec54f5516913b3caf8 /src/render/renderdocument.nim
parent1c6ce0892f5ca63682fa2c4dfe9d6a4e81558eb4 (diff)
downloadchawan-667ca4188a9e587111ed48bd82ecdab6f1035229.tar.gz
calculateErrorY: fix regression by using int
Obviously we can't calculate rounding error without rounding.
Diffstat (limited to 'src/render/renderdocument.nim')
-rw-r--r--src/render/renderdocument.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/render/renderdocument.nim b/src/render/renderdocument.nim
index 6e8b4223..afde059b 100644
--- a/src/render/renderdocument.nim
+++ b/src/render/renderdocument.nim
@@ -285,10 +285,10 @@ proc paintBackground(lines: var FlexibleGrid, color: RGBAColor, startx,
 func calculateErrorY(ctx: InlineContext, window: WindowAttributes):
     LayoutUnit =
   if ctx.lines.len <= 1: return 0
-  var error: LayoutUnit = 0
+  var error = 0
   for i in 0 ..< ctx.lines.len:
     if i < ctx.lines.high:
-      let dy = ctx.lines[i + 1].offset.y - ctx.lines[i].offset.y
+      let dy = toInt(ctx.lines[i + 1].offset.y - ctx.lines[i].offset.y)
       error += dy - (dy div window.ppl) * window.ppl
   return error div (ctx.lines.len - 1)