From de0251debf593b82f5edcc8bf0e155eb55b5fd5f Mon Sep 17 00:00:00 2001 From: bptato Date: Wed, 10 Apr 2024 00:03:34 +0200 Subject: term: do not eat last DA1 value --- src/local/term.nim | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/local/term.nim') diff --git a/src/local/term.nim b/src/local/term.nim index e8f989cd..c654d890 100644 --- a/src/local/term.nim +++ b/src/local/term.nim @@ -708,16 +708,22 @@ proc queryAttrs(term: Terminal, windowOnly: bool): QueryResult = case (let c = term.consume; c) of '?': # DA1 var n = 0 - while (let c = term.consume; c != 'c'): - if c == ';': + while true: + let c = term.consume + let x = decValue(c) + if x == -1: case n of 4: result.attrs.incl(qaSixel) of 22: result.attrs.incl(qaAnsiColor) else: discard n = 0 + if c == 'c': + break + if c != ';': + fail else: n *= 10 - n += decValue(c) + n += x result.success = true break # DA1 returned; done of '4', '8': # GEOMPIXEL, GEOMCELL -- cgit 1.4.1-2-gfad0