Forcing a redraw of a line only when it contains a multicolumn character,

as that is the only known situation where things go wrong.  This spares
all regular text a significant slowdown.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5370 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2015-09-05 09:14:24 +00:00
parent 9205c28865
commit 954d04bc59
2 changed files with 14 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2015-09-05 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (display_string, edit_draw): Force a redraw of a line
only when it contains a multicolumn character, to spare all regular
text this significant slowdown. This fixes Savannah bug #45684
reported by Wyatt Ward.
2015-09-04 Benno Schulenberg <bensberg@justemail.net>
* src/chars.c: Reverting r5354 from August 12. This fixes Savannah
bug #45874. Apparently there is /some/ state somewhere after all.

View File

@ -40,6 +40,8 @@ static int statusblank = 0;
static bool disable_cursorpos = FALSE;
/* Should we temporarily disable constant cursor position
* display? */
static bool seen_wide = FALSE;
/* Whether we've seen a multicolumn character in the current line. */
static sig_atomic_t sigwinch_counter_save = 0;
@ -1896,6 +1898,7 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
converted = charalloc(alloc_len);
index = 0;
seen_wide = FALSE;
if (buf[start_index] != '\0' && buf[start_index] != '\t' &&
(column < start_col || (dollars && column > 0))) {
@ -1939,6 +1942,9 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
while (buf[start_index] != '\0') {
buf_mb_len = parse_mbchar(buf + start_index, buf_mb, NULL);
if (mbwidth(buf + start_index) > 1)
seen_wide = TRUE;
/* Make sure there's enough room for the next character, whether
* it's a multibyte control character, a non-control multibyte
* character, a tab character, or a null terminator. */
@ -2472,6 +2478,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int
/* Tell ncurses to really redraw the line without trying to optimize
* for what it thinks is already there, because it gets it wrong in
* the case of a wide character in column zero. See bug #31743. */
if (seen_wide)
wredrawln(edit, line, 1);
#endif