about summary refs log tree commit diff stats
path: root/src/local
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-09-09 21:45:53 +0200
committerbptato <nincsnevem662@gmail.com>2024-09-09 21:45:53 +0200
commit1ddb53f3c22693c34eb84ca1c6945396b98996c1 (patch)
treef1ae9963e51fc4705841a90b130692da67e31bc6 /src/local
parent897242815ed1f4e396fa5af45ede96d084de4fc4 (diff)
downloadchawan-1ddb53f3c22693c34eb84ca1c6945396b98996c1.tar.gz
pager, term: fix kitty display, add a sixel bounds check
Diffstat (limited to 'src/local')
-rw-r--r--src/local/pager.nim4
-rw-r--r--src/local/term.nim5
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) &