diff options
author | bptato <nincsnevem662@gmail.com> | 2024-07-20 15:36:39 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-07-20 15:36:39 +0200 |
commit | f60f8010604c227d13e1d953f1565d4d54174416 (patch) | |
tree | 2cfbf8112fa55f4357bdbed5243e17a71e2c7ba8 | |
parent | 7cafa1f5e0f1e83ec5064764284433d64e94cc9f (diff) | |
download | chawan-f60f8010604c227d13e1d953f1565d4d54174416.tar.gz |
term: fix kitty image positioning
only use sixelMaxWidth/sixelMaxHeight for sixel
-rw-r--r-- | src/local/term.nim | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/local/term.nim b/src/local/term.nim index 37ec90e1..109c6710 100644 --- a/src/local/term.nim +++ b/src/local/term.nim @@ -647,8 +647,11 @@ proc positionImage(term: Terminal; image: CanvasImage; x, y, maxw, maxh: int): image.offy = -min(ypx, 0) # calculate maximum image size that fits on the screen relative to the image # origin (*not* offx/offy) - let maxwpx = min(maxw * term.attrs.ppc, term.sixelMaxWidth) - let maxhpx = min(maxh * term.attrs.ppl, term.sixelMaxHeight) + var maxwpx = maxw * term.attrs.ppc + var maxhpx = maxh * term.attrs.ppl + if term.imageMode == imSixel: + maxwpx = min(maxwpx, term.sixelMaxWidth) + maxhpx = min(maxhpx, term.sixelMaxHeight) image.dispw = min(int(image.bmp.width) + xpx, maxwpx) - xpx image.disph = min(int(image.bmp.height) + ypx, maxhpx) - ypx image.damaged = true |