aboutsummaryrefslogtreecommitdiffstats
path: root/src/local
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-08-27 23:13:51 +0200
committerbptato <nincsnevem662@gmail.com>2024-08-27 23:24:14 +0200
commit9f644c7a2c507fa08df4d9a7b2f846ffa72f18ea (patch)
tree7d3e7d7fe10281088d0fd9610b7819202b23b7e8 /src/local
parentcfccb59aa9694bef4802dcc4438ca24e78819e21 (diff)
downloadchawan-9f644c7a2c507fa08df4d9a7b2f846ffa72f18ea.tar.gz
term: fix crash on identical stacked images
in fact, we consider these to be the same image, and arguably that's a bug in and of itself. but at least we don't crash anymore. (also, update todo)
Diffstat (limited to 'src/local')
-rw-r--r--src/local/term.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/local/term.nim b/src/local/term.nim
index 3b2b8050..f2faaa13 100644
--- a/src/local/term.nim
+++ b/src/local/term.nim
@@ -65,6 +65,7 @@ type
disph: int
damaged: bool
marked*: bool
+ dead: bool
kittyId: int
bmp: Bitmap
# 0 if kitty
@@ -645,7 +646,7 @@ proc outputGrid*(term: Terminal) =
func findImage(term: Terminal; pid, imageId: int; bmp: Bitmap;
rx, ry, erry, offx, dispw: int): CanvasImage =
for it in term.canvasImages:
- if it.pid == pid and it.imageId == imageId and
+ if not it.dead and it.pid == pid and it.imageId == imageId and
it.bmp.width == bmp.width and it.bmp.height == bmp.height and
it.rx == rx and it.ry == ry and
(term.imageMode != imSixel or it.erry == erry and it.dispw == dispw and
@@ -709,6 +710,7 @@ proc loadImage*(term: Terminal; bmp: Bitmap; data: Blob; pid, imageId,
term.clearImage(image, maxh)
if not term.positionImage(image, x, y, maxw, maxh):
# no longer on screen
+ image.dead = true
return nil
elif term.imageMode == imSixel:
# check if any line of our image is damaged