commit feacacc46df9c8f280d95c8a951c752c3bb4831b
parent af53c56ec8cb59ab4a2569a8aa00ec8de753b36c
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Sat, 4 Jun 2016 22:08:47 +0200
chars: look at bytes in their context, so only valid sequences are accepted
This fixes https://savannah.gnu.org/bugs/?48125.
(The fix is slightly wasteful; speeding things up will follow later.)
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/winio.c b/src/winio.c
@@ -1784,7 +1784,7 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
* the left of the screen. */
buf_mb_len = parse_mbchar(buf + start_index, buf_mb, NULL);
- if (is_cntrl_mbchar(buf_mb)) {
+ if (is_cntrl_mbchar(buf + start_index)) {
if (column < start_col) {
converted[index++] = control_mbrep(buf_mb);
start_col++;
@@ -1850,7 +1850,7 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
start_col++;
}
/* If buf contains a control character, represent it. */
- } else if (is_cntrl_mbchar(buf_mb)) {
+ } else if (is_cntrl_mbchar(buf + start_index)) {
converted[index++] = '^';
converted[index++] = control_mbrep(buf_mb);
start_col += 2;