aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-07-23 18:28:51 +0200
committerbptato <nincsnevem662@gmail.com>2024-07-23 18:28:51 +0200
commitf6662b22db1d8d9d00cd182c687cffff1aba65da (patch)
tree522eb33206a5f59671c448d95672a94c47db0574
parent2cc62cd65007913f6d46318f1cc46299b7878159 (diff)
downloadchawan-f6662b22db1d8d9d00cd182c687cffff1aba65da.tar.gz
term: fix positionImage sixel size clamping (take 2)
Hope I got it right this time. (The previous iteration did not take into account the image position on the screen, so it was just as bad as the first one.)
-rw-r--r--src/local/term.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/local/term.nim b/src/local/term.nim
index 4d915ec7..7391a17e 100644
--- a/src/local/term.nim
+++ b/src/local/term.nim
@@ -654,8 +654,8 @@ proc positionImage(term: Terminal; image: CanvasImage; x, y, maxw, maxh: int):
if term.imageMode == imSixel:
#TODO a better solution would be to split up the image here so that it
# still gets fully displayed on the screen, or at least downscale it...
- width = min(width, term.sixelMaxWidth)
- height = min(height, term.sixelMaxHeight)
+ width = min(width - image.offx, term.sixelMaxWidth) + image.offx
+ height = min(height - image.offy, term.sixelMaxHeight) + image.offy
image.dispw = min(width + xpx, maxwpx) - xpx
image.disph = min(height + ypx, maxhpx) - ypx
image.damaged = true