about summary refs log tree commit diff stats
path: root/src/render
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-04-12 12:20:00 +0200
committerbptato <nincsnevem662@gmail.com>2023-04-12 12:20:00 +0200
commit92a46cf87861db593e8145ffc317dc7d72a13281 (patch)
tree863766088a3b0e1ff0700f4c5d08def618354f8d /src/render
parent229e020eba43b1aa2a3ab452461aec133d1f5c1f (diff)
downloadchawan-92a46cf87861db593e8145ffc317dc7d72a13281.tar.gz
renderdocument: fix img position
Diffstat (limited to 'src/render')
-rw-r--r--src/render/renderdocument.nim10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/render/renderdocument.nim b/src/render/renderdocument.nim
index 31bdfcf2..30da6257 100644
--- a/src/render/renderdocument.nim
+++ b/src/render/renderdocument.nim
@@ -329,13 +329,13 @@ proc renderBlockBox(grid: var FlexibleGrid, box: BlockBox, x, y: int, window: Wi
       # ugly hack for background-image display... TODO actually display images
       let s = "[img]"
       let w = s.len * window.ppc
-      var x = x
+      var ix = x
       if box.width < w:
         # text is larger than image; center it to minimize error
-        x -= w div 2
-        x += box.width div 2
-      x = x div window.ppc
-      y = y div window.ppl
+        ix -= w div 2
+        ix += box.width div 2
+      let x = ix div window.ppc
+      let y = y div window.ppl
       if y >= 0 and x + w >= 0:
         grid.setText(s, ComputedFormat(node: box.node), x, y)