mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-30 00:23:28 +03:00
screen: include a workaround only when compiling against older ncurses
The bug with a leading wide character has been fixed since ncurses-5.9. See https://savannah.gnu.org/bugs/?31743 for reference.
This commit is contained in:
parent
1c2d2a4027
commit
8c7a38596d
@ -92,6 +92,10 @@
|
|||||||
#include <curses.h>
|
#include <curses.h>
|
||||||
#endif /* CURSES_H */
|
#endif /* CURSES_H */
|
||||||
|
|
||||||
|
#if defined(NCURSES_VERSION_MAJOR) && (NCURSES_VERSION_MAJOR < 6)
|
||||||
|
#define USING_OLD_NCURSES yes
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
/* Native language support. */
|
/* Native language support. */
|
||||||
#ifdef HAVE_LIBINTL_H
|
#ifdef HAVE_LIBINTL_H
|
||||||
|
@ -46,8 +46,10 @@ static int statusblank = 0;
|
|||||||
/* The number of keystrokes left before we blank the statusbar. */
|
/* The number of keystrokes left before we blank the statusbar. */
|
||||||
static bool suppress_cursorpos = FALSE;
|
static bool suppress_cursorpos = FALSE;
|
||||||
/* Should we skip constant position display for one keystroke? */
|
/* Should we skip constant position display for one keystroke? */
|
||||||
|
#ifdef USING_OLD_NCURSES
|
||||||
static bool seen_wide = FALSE;
|
static bool seen_wide = FALSE;
|
||||||
/* Whether we've seen a multicolumn character in the current line. */
|
/* Whether we've seen a multicolumn character in the current line. */
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
static sig_atomic_t last_sigwinch_counter = 0;
|
static sig_atomic_t last_sigwinch_counter = 0;
|
||||||
@ -1761,7 +1763,9 @@ char *display_string(const char *buf, size_t start_col, size_t span,
|
|||||||
converted = charalloc(strlen(buf) * (mb_cur_max() + tabsize) + 1);
|
converted = charalloc(strlen(buf) * (mb_cur_max() + tabsize) + 1);
|
||||||
|
|
||||||
index = 0;
|
index = 0;
|
||||||
|
#ifdef USING_OLD_NCURSES
|
||||||
seen_wide = FALSE;
|
seen_wide = FALSE;
|
||||||
|
#endif
|
||||||
buf += start_index;
|
buf += start_index;
|
||||||
|
|
||||||
if (*buf != '\0' && *buf != '\t' &&
|
if (*buf != '\0' && *buf != '\t' &&
|
||||||
@ -1845,9 +1849,10 @@ char *display_string(const char *buf, size_t start_col, size_t span,
|
|||||||
converted[index++] = *(buf++);
|
converted[index++] = *(buf++);
|
||||||
|
|
||||||
start_col += charwidth;
|
start_col += charwidth;
|
||||||
|
#ifdef USING_OLD_NCURSES
|
||||||
if (charwidth > 1)
|
if (charwidth > 1)
|
||||||
seen_wide = TRUE;
|
seen_wide = TRUE;
|
||||||
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2229,7 +2234,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int
|
|||||||
* marking highlight on just the pieces that need it. */
|
* marking highlight on just the pieces that need it. */
|
||||||
mvwaddstr(edit, line, 0, converted);
|
mvwaddstr(edit, line, 0, converted);
|
||||||
|
|
||||||
#ifndef USE_SLANG
|
#ifdef USING_OLD_NCURSES
|
||||||
/* Tell ncurses to really redraw the line without trying to optimize
|
/* Tell ncurses to really redraw the line without trying to optimize
|
||||||
* for what it thinks is already there, because it gets it wrong in
|
* 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. */
|
* the case of a wide character in column zero. See bug #31743. */
|
||||||
|
Loading…
Reference in New Issue
Block a user