diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-02-26 19:40:59 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-02-26 19:40:59 +0100 |
commit | 38632faf635f6434441827e136bceb5a930c59ad (patch) | |
tree | d3dfd450f86d253c7636f11a25c5bbb178e49fa9 | |
parent | 74a47162a07fddb532f4bead212f6c80ef474ae7 (diff) | |
download | vim-git-38632faf635f6434441827e136bceb5a930c59ad.tar.gz |
patch 8.0.0380: with 'linebreak' double wide char wraps badlyv8.0.0380
Problem: With 'linebreak' set and 'breakat' includes ">" a double-wide
character results in "<<" displayed.
Solution: Check for the character not to be replaced. (Ozaki Kiichi,
closes #1456)
-rw-r--r-- | src/screen.c | 9 | ||||
-rw-r--r-- | src/testdir/test_listlbr_utf8.vim | 27 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 35 insertions, 3 deletions
diff --git a/src/screen.c b/src/screen.c index d801c4cc1..cc9c9f6dc 100644 --- a/src/screen.c +++ b/src/screen.c @@ -4189,6 +4189,8 @@ win_line( } else { + int c0; + if (p_extra_free != NULL) { vim_free(p_extra_free); @@ -4197,7 +4199,7 @@ win_line( /* * Get a character from the line itself. */ - c = *ptr; + c0 = c = *ptr; #ifdef FEAT_MBYTE if (has_mbyte) { @@ -4214,7 +4216,7 @@ win_line( /* Overlong encoded ASCII or ASCII with composing char * is displayed normally, except a NUL. */ if (mb_c < 0x80) - c = mb_c; + c0 = c = mb_c; mb_utf8 = TRUE; /* At start of the line we can have a composing char. @@ -4538,7 +4540,8 @@ win_line( /* * Found last space before word: check for line break. */ - if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr)) + if (wp->w_p_lbr && c0 == c + && vim_isbreak(c) && !vim_isbreak(*ptr)) { # ifdef FEAT_MBYTE int mb_off = has_mbyte ? (*mb_head_off)(line, ptr - 1) : 0; diff --git a/src/testdir/test_listlbr_utf8.vim b/src/testdir/test_listlbr_utf8.vim index 807b6ad31..99db37ee6 100644 --- a/src/testdir/test_listlbr_utf8.vim +++ b/src/testdir/test_listlbr_utf8.vim @@ -193,3 +193,30 @@ func Test_multibyte_sign_and_colorcolumn() call s:compare_lines(expect, lines) call s:close_windows() endfunc + +func Test_illegal_byte_and_breakat() + call s:test_windows("setl sbr= brk+=<") + vert resize 18 + call setline(1, repeat("\x80", 6)) + redraw! + let lines = s:screen_lines([1, 2], winwidth(0)) + let expect = [ +\ "<80><80><80><80><8", +\ "0><80> ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows('setl brk&vim') +endfunc + +func Test_multibyte_wrap_and_breakat() + call s:test_windows("setl sbr= brk+=>") + call setline(1, repeat('a', 17) . repeat('あ', 2)) + redraw! + let lines = s:screen_lines([1, 2], winwidth(0)) + let expect = [ +\ "aaaaaaaaaaaaaaaaaあ>", +\ "あ ", +\ ] + call s:compare_lines(expect, lines) + call s:close_windows('setl brk&vim') +endfunc diff --git a/src/version.c b/src/version.c index 21f416950..7408b6df3 100644 --- a/src/version.c +++ b/src/version.c @@ -765,6 +765,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 380, +/**/ 379, /**/ 378, |