vim-patch:8.1.1338: fix hang when concealing wide char #10023

Problem:    Hang when concealing the '>' shown for a wide char that doesn't
            fit in the last cell.
Solution:   Put back the pointer when the '>' is not going to be displayed.
            (closes vim/vim#4377)
0ebe12be86
This commit is contained in:
Jan Edmund Lazo 2019-05-18 04:18:48 -04:00 committed by Justin M. Keyes
parent 9420a2127f
commit 5625c7d8e1

View File

@ -2171,7 +2171,6 @@ win_line (
int vcol_off = 0; ///< offset for concealed characters int vcol_off = 0; ///< offset for concealed characters
int did_wcol = false; int did_wcol = false;
int match_conc = 0; ///< cchar for match functions int match_conc = 0; ///< cchar for match functions
int has_match_conc = 0; ///< match wants to conceal
int old_boguscols = 0; int old_boguscols = 0;
# define VCOL_HLC (vcol - vcol_off) # define VCOL_HLC (vcol - vcol_off)
# define FIX_FOR_BOGUSCOLS \ # define FIX_FOR_BOGUSCOLS \
@ -2656,7 +2655,8 @@ win_line (
int sign_idx = 0; int sign_idx = 0;
// Repeat for the whole displayed line. // Repeat for the whole displayed line.
for (;; ) { for (;; ) {
has_match_conc = 0; int has_match_conc = 0; ///< match wants to conceal
bool did_decrement_ptr = false;
// Skip this quickly when working on the text. // Skip this quickly when working on the text.
if (draw_state != WL_LINE) { if (draw_state != WL_LINE) {
if (draw_state == WL_CMDLINE - 1 && n_extra == 0) { if (draw_state == WL_CMDLINE - 1 && n_extra == 0) {
@ -3229,6 +3229,7 @@ win_line (
// Put pointer back so that the character will be // Put pointer back so that the character will be
// displayed at the start of the next line. // displayed at the start of the next line.
ptr--; ptr--;
did_decrement_ptr = true;
} else if (*ptr != NUL) { } else if (*ptr != NUL) {
ptr += mb_l - 1; ptr += mb_l - 1;
} }
@ -3687,6 +3688,11 @@ win_line (
prev_syntax_id = 0; prev_syntax_id = 0;
is_concealing = FALSE; is_concealing = FALSE;
} }
if (n_skip > 0 && did_decrement_ptr) {
// not showing the '>', put pointer back to avoid getting stuck
ptr++;
}
} }
/* In the cursor line and we may be concealing characters: correct /* In the cursor line and we may be concealing characters: correct