From f6662b22db1d8d9d00cd182c687cffff1aba65da Mon Sep 17 00:00:00 2001 From: bptato Date: Tue, 23 Jul 2024 18:28:51 +0200 Subject: 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.) --- src/local/term.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/local') 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 -- cgit 1.4.1-2-gfad0