diff options
author | bptato <nincsnevem662@gmail.com> | 2024-09-09 21:45:53 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-09-09 21:45:53 +0200 |
commit | 1ddb53f3c22693c34eb84ca1c6945396b98996c1 (patch) | |
tree | f1ae9963e51fc4705841a90b130692da67e31bc6 /src/local | |
parent | 897242815ed1f4e396fa5af45ede96d084de4fc4 (diff) | |
download | chawan-1ddb53f3c22693c34eb84ca1c6945396b98996c1.tar.gz |
pager, term: fix kitty display, add a sixel bounds check
Diffstat (limited to 'src/local')
-rw-r--r-- | src/local/pager.nim | 4 | ||||
-rw-r--r-- | src/local/term.nim | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/local/pager.nim b/src/local/pager.nim index 3822eb77..b0521706 100644 --- a/src/local/pager.nim +++ b/src/local/pager.nim @@ -575,8 +575,8 @@ proc initImages(pager: Pager; container: Container) = dispw = min(width + xpx, maxwpx) - xpx let ypx = (image.y - container.fromy) * pager.attrs.ppl erry = -min(ypx, 0) mod 6 - if dispw <= offx: - continue + if dispw <= offx: + continue let cached = container.findCachedImage(image, offx, erry, dispw) let imageId = image.bmp.imageId if cached == nil: diff --git a/src/local/term.nim b/src/local/term.nim index 2f31104a..e9b404a1 100644 --- a/src/local/term.nim +++ b/src/local/term.nim @@ -821,8 +821,9 @@ proc outputSixelImage(term: Terminal; x, y: int; image: CanvasImage; proc outputSixelImage(term: Terminal; x, y: int; image: CanvasImage) = var p = cast[ptr UncheckedArray[char]](image.data.buffer) - let H = int(image.data.size - 1) - term.outputSixelImage(x, y, image, p.toOpenArray(0, H)) + if image.data.size > 0: + let H = int(image.data.size - 1) + term.outputSixelImage(x, y, image, p.toOpenArray(0, H)) proc outputKittyImage(term: Terminal; x, y: int; image: CanvasImage) = var outs = term.cursorGoto(x, y) & |