about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-12-27 19:24:46 +0100
committerbptato <nincsnevem662@gmail.com>2024-12-27 19:24:46 +0100
commit9f7f3cefa857c7d1b42d4c66d7325c9d880681be (patch)
tree6a7a958198e7754db0484eda31ef9b520b670ba5 /src
parentdff94db8a286d6b863305f84ace65e9806313331 (diff)
downloadchawan-9f7f3cefa857c7d1b42d4c66d7325c9d880681be.tar.gz
term: fix in-cell offset bug on kitty image scroll
If the image has an offx or offy, then it means it is partially outside
the screen, so its offx2/offy2 is already accounted for.
Diffstat (limited to 'src')
-rw-r--r--src/local/term.nim5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/local/term.nim b/src/local/term.nim
index ccb1806d..77af9ea4 100644
--- a/src/local/term.nim
+++ b/src/local/term.nim
@@ -724,6 +724,11 @@ proc positionImage(term: Terminal; image: CanvasImage;
   # calculate offset inside image to start from
   image.offx = -min(xpx, 0)
   image.offy = -min(ypx, 0)
+  # clear offx2/offy2 if the image starts outside the screen
+  if image.offx > 0:
+    image.offx2 = 0
+  if image.offy > 0:
+    image.offy2 = 0
   # calculate maximum image size that fits on the screen relative to the image
   # origin (*not* offx/offy)
   let maxwpx = maxw * term.attrs.ppc