diff options
author | bptato <nincsnevem662@gmail.com> | 2024-12-27 19:24:46 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-12-27 19:24:46 +0100 |
commit | 9f7f3cefa857c7d1b42d4c66d7325c9d880681be (patch) | |
tree | 6a7a958198e7754db0484eda31ef9b520b670ba5 /src | |
parent | dff94db8a286d6b863305f84ace65e9806313331 (diff) | |
download | chawan-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.nim | 5 |
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 |