watch: Don't process additional numbers in unknown ANSI color escapes
authorJosh Triplett <josh@joshtriplett.org>
Sat, 9 Jul 2016 04:52:54 +0000 (14:52 +1000)
committerCraig Small <csmall@enc.com.au>
Sat, 9 Jul 2016 04:52:54 +0000 (14:52 +1000)
commit261c571acafed88d03ebdb5c5fa3d7e084daf25b
tree455c5f8a8b29e7e4c304b72950057bf17d2e16b4
parentab0b00a2396348471dae850d306a756951820adc
watch: Don't process additional numbers in unknown ANSI color escapes

process_ansi assumed all numbers in a color control sequence correspond
to colors or attributes, which breaks badly if it encounters a
ISO-8613-3 escape sequence (such as for truecolor RGB).  For instance,
the sequence "\x1b[38;2;10;20;30m" sets the foreground color to
rgb(10,20,30), but watch will interpret all five numbers in the sequence
as colors or attributes themselves.

Stop processing the entire escape sequence if watch encounters any
number it doesn't understand, as that number may change the meaning of
the rest of the sequence.
watch.c