File tree Expand file tree Collapse file tree 3 files changed +35
-3
lines changed
Expand file tree Collapse file tree 3 files changed +35
-3
lines changed Original file line number Diff line number Diff line change @@ -4189,6 +4189,8 @@ win_line(
41894189 }
41904190 else
41914191 {
4192+ int c0 ;
4193+
41924194 if (p_extra_free != NULL )
41934195 {
41944196 vim_free (p_extra_free );
@@ -4197,7 +4199,7 @@ win_line(
41974199 /*
41984200 * Get a character from the line itself.
41994201 */
4200- c = * ptr ;
4202+ c0 = c = * ptr ;
42014203#ifdef FEAT_MBYTE
42024204 if (has_mbyte )
42034205 {
@@ -4214,7 +4216,7 @@ win_line(
42144216 /* Overlong encoded ASCII or ASCII with composing char
42154217 * is displayed normally, except a NUL. */
42164218 if (mb_c < 0x80 )
4217- c = mb_c ;
4219+ c0 = c = mb_c ;
42184220 mb_utf8 = TRUE;
42194221
42204222 /* At start of the line we can have a composing char.
@@ -4538,7 +4540,8 @@ win_line(
45384540 /*
45394541 * Found last space before word: check for line break.
45404542 */
4541- if (wp -> w_p_lbr && vim_isbreak (c ) && !vim_isbreak (* ptr ))
4543+ if (wp -> w_p_lbr && c0 == c
4544+ && vim_isbreak (c ) && !vim_isbreak (* ptr ))
45424545 {
45434546# ifdef FEAT_MBYTE
45444547 int mb_off = has_mbyte ? (* mb_head_off )(line , ptr - 1 ) : 0 ;
Original file line number Diff line number Diff line change @@ -193,3 +193,30 @@ func Test_multibyte_sign_and_colorcolumn()
193193 call s: compare_lines (expect, lines )
194194 call s: close_windows ()
195195endfunc
196+
197+ func Test_illegal_byte_and_breakat ()
198+ call s: test_windows (" setl sbr= brk+=<" )
199+ vert resize 18
200+ call setline (1 , repeat (" \x80 " , 6 ))
201+ redraw !
202+ let lines = s: screen_lines ([1 , 2 ], winwidth (0 ))
203+ let expect = [
204+ \ " <80><80><80><80><8" ,
205+ \ " 0><80> " ,
206+ \ ]
207+ call s: compare_lines (expect, lines )
208+ call s: close_windows (' setl brk&vim' )
209+ endfunc
210+
211+ func Test_multibyte_wrap_and_breakat ()
212+ call s: test_windows (" setl sbr= brk+=>" )
213+ call setline (1 , repeat (' a' , 17 ) . repeat (' あ' , 2 ))
214+ redraw !
215+ let lines = s: screen_lines ([1 , 2 ], winwidth (0 ))
216+ let expect = [
217+ \ " aaaaaaaaaaaaaaaaaあ>" ,
218+ \ " あ " ,
219+ \ ]
220+ call s: compare_lines (expect, lines )
221+ call s: close_windows (' setl brk&vim' )
222+ endfunc
Original file line number Diff line number Diff line change @@ -764,6 +764,8 @@ static char *(features[]) =
764764
765765static int included_patches [] =
766766{ /* Add new patch number below this line */
767+ /**/
768+ 380 ,
767769/**/
768770 379 ,
769771/**/
You can’t perform that action at this time.
0 commit comments