From 67600fc8e11841368ae233c869ad81d271b0faa1 Mon Sep 17 00:00:00 2001 From: bptato Date: Wed, 28 Aug 2024 19:54:43 +0200 Subject: sixel: minor optimizations * don't emit transparency request when we don't need it * add lookup table for missing hash entries * write(2)'ize --- src/local/term.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/local') diff --git a/src/local/term.nim b/src/local/term.nim index afeb12df..abfa7563 100644 --- a/src/local/term.nim +++ b/src/local/term.nim @@ -757,7 +757,9 @@ proc outputSixelImage(term: Terminal; x, y: int; image: CanvasImage; # set raster attributes let realw = dispw - offx let realh = disph - offy - outs &= "\"1;1;" & $realw & ';' & $realh + # transparent if we want to draw a non-6-divisible number of rows + let trans = realh mod 6 != 0 + outs &= "\"1;" & $int(trans) & ";" & $realw & ';' & $realh term.write(outs) let sraLen = int(data.getU32BE(0)) let preludeLen = sraLen + 4 -- cgit