nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nano-devel] [PATCH 5/5] chars: look at bytes in their context, so only


From: Benno Schulenberg
Subject: [Nano-devel] [PATCH 5/5] chars: look at bytes in their context, so only valid sequences are accepted
Date: Sun, 5 Jun 2016 09:46:21 +0200

This fixes https://savannah.gnu.org/bugs/?48125.

(The fix is slightly wasteful; speeding things up will follow later.)
---
 src/winio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/winio.c b/src/winio.c
index f5078db..b1df03f 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -1790,7 +1790,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++;
@@ -1856,7 +1856,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;
-- 
2.8.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]