@@ -779,7 +779,7 @@ win_line(
779779 trailcol = (colnr_T )STRLEN (ptr );
780780 while (trailcol > (colnr_T )0 && VIM_ISWHITE (ptr [trailcol - 1 ]))
781781 -- trailcol ;
782- trailcol += (colnr_T ) (ptr - line );
782+ trailcol += (colnr_T )(ptr - line );
783783 }
784784 // find end of leading whitespace
785785 if (wp -> w_lcs_chars .lead || wp -> w_lcs_chars .leadmultispace != NULL )
@@ -792,7 +792,7 @@ win_line(
792792 leadcol = (colnr_T )0 ;
793793 else
794794 // keep track of the first column not filled with spaces
795- leadcol += (colnr_T ) (ptr - line ) + 1 ;
795+ leadcol += (colnr_T )(ptr - line ) + 1 ;
796796 }
797797 }
798798
@@ -1027,12 +1027,14 @@ win_line(
10271027 // Repeat for the whole displayed line.
10281028 for (;;)
10291029 {
1030+ char_u * prev_ptr = ptr ;
10301031#if defined(FEAT_CONCEAL ) || defined(FEAT_SEARCH_EXTRA )
1031- int has_match_conc = 0 ; // match wants to conceal
1032+ int has_match_conc = 0 ; // match wants to conceal
10321033#endif
10331034#ifdef FEAT_CONCEAL
1034- int did_decrement_ptr = FALSE;
1035+ int did_decrement_ptr = FALSE;
10351036#endif
1037+
10361038 // Skip this quickly when working on the text.
10371039 if (draw_state != WL_LINE )
10381040 {
@@ -1392,6 +1394,7 @@ win_line(
13921394 & match_conc , did_line_attr , lcs_eol_one ,
13931395 & on_last_col );
13941396 ptr = line + v ; // "line" may have been changed
1397+ prev_ptr = ptr ;
13951398
13961399 // Do not allow a conceal over EOL otherwise EOL will be missed
13971400 // and bad things happen.
@@ -1553,6 +1556,7 @@ win_line(
15531556 // have made it invalid.
15541557 line = ml_get_buf (wp -> w_buffer , lnum , FALSE);
15551558 ptr = line + v ;
1559+ prev_ptr = ptr ;
15561560# ifdef FEAT_CONCEAL
15571561 // no concealing past the end of the line, it interferes
15581562 // with line highlighting
@@ -1733,9 +1737,10 @@ win_line(
17331737 else
17341738 {
17351739#ifdef FEAT_LINEBREAK
1736- int c0 ;
1740+ int c0 ;
17371741#endif
17381742 VIM_CLEAR (p_extra_free );
1743+ prev_ptr = ptr ;
17391744
17401745 // Get a character from the line itself.
17411746 c = * ptr ;
@@ -1942,17 +1947,12 @@ win_line(
19421947# endif
19431948 can_spell ))
19441949 {
1945- char_u * prev_ptr , * p ;
1950+ char_u * p ;
19461951 int len ;
19471952 hlf_T spell_hlf = HLF_COUNT ;
19481953
19491954 if (has_mbyte )
1950- {
1951- prev_ptr = ptr - mb_l ;
19521955 v -= mb_l - 1 ;
1953- }
1954- else
1955- prev_ptr = ptr - 1 ;
19561956
19571957 // Use nextline[] if possible, it has the start of the
19581958 // next line concatenated.
@@ -2775,6 +2775,7 @@ win_line(
27752775 }
27762776#endif
27772777 ScreenAttrs [off ] = char_attr ;
2778+ ScreenCols [off ] = MAXCOL ;
27782779#ifdef FEAT_RIGHTLEFT
27792780 if (wp -> w_p_rl )
27802781 {
@@ -2843,6 +2844,7 @@ win_line(
28432844 ScreenLines [off ] = ' ' ;
28442845 if (enc_utf8 )
28452846 ScreenLinesUC [off ] = 0 ;
2847+ ScreenCols [off ] = MAXCOL ;
28462848 ++ col ;
28472849 if (draw_color_col )
28482850 draw_color_col = advance_color_col (VCOL_HLC ,
@@ -2996,6 +2998,8 @@ win_line(
29962998 else
29972999 ScreenAttrs [off ] = char_attr ;
29983000
3001+ ScreenCols [off ] = (colnr_T )(prev_ptr - line );
3002+
29993003 if (has_mbyte && (* mb_char2cells )(mb_c ) > 1 )
30003004 {
30013005 // Need to fill two screen columns.
@@ -3017,6 +3021,9 @@ win_line(
30173021 // the character, otherwise highlighting won't stop.
30183022 if (tocol == vcol )
30193023 ++ tocol ;
3024+
3025+ ScreenCols [off ] = (colnr_T )(prev_ptr - line );
3026+
30203027#ifdef FEAT_RIGHTLEFT
30213028 if (wp -> w_p_rl )
30223029 {
0 commit comments