about summary refs log tree commit diff stats
path: root/src/local/term.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-04-10 00:03:34 +0200
committerbptato <nincsnevem662@gmail.com>2024-04-10 00:14:49 +0200
commitde0251debf593b82f5edcc8bf0e155eb55b5fd5f (patch)
treee960da757442b102a938629b4d5c344c2b5f4244 /src/local/term.nim
parent30792bebc5d8e555a7cb042d002035c2df3beb89 (diff)
downloadchawan-de0251debf593b82f5edcc8bf0e155eb55b5fd5f.tar.gz
term: do not eat last DA1 value
Diffstat (limited to 'src/local/term.nim')
-rw-r--r--src/local/term.nim12
1 files changed, 9 insertions, 3 deletions
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