diff options
author | Ron Yorston <rmy@pobox.com> | 2021-03-05 12:48:06 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-03-05 12:48:06 +0000 |
commit | dfa16f84deb0bf0d1f1cc8d223f695b2f971fc40 (patch) | |
tree | 4aaa042a72fe85c0722763fccc1cb5e3347c5025 /init | |
parent | b4506956a5703ae2df062ec307d76ac935be0258 (diff) | |
download | busybox-w32-dfa16f84deb0bf0d1f1cc8d223f695b2f971fc40.tar.gz busybox-w32-dfa16f84deb0bf0d1f1cc8d223f695b2f971fc40.tar.bz2 busybox-w32-dfa16f84deb0bf0d1f1cc8d223f695b2f971fc40.zip |
winansi: fix ansi emulation
The following commands (reported in GitHub issue #201):
printf "\033[38;2;255;0;0mX\033[m\n"
printf "\033[38;2;255;0;0m;\033[m\n"
produce different results. The first correctly displays a red 'X'
while the second incorrectly displays a white ';'.
The problem is that process_24bit() overruns the extent of the
escape sequence. As a result the loop in process_escape() which
handles 'ESC[...m' sequences sees the ';' in the text as a
continuation of the escape sequence.
Fix this by:
- reworking process_24bit() so that the overrun is avoided;
- changing the test in the loop in process_escape() so that even
if an overrun happens it stops processing at the end of the escape
sequence.
Also, save a few bytes by replacing '++str' with 'str + 1' in a
few places.
Diffstat (limited to 'init')
0 files changed, 0 insertions, 0 deletions