To: vim_dev@googlegroups.com Subject: Patch 8.0.0380 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.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) Files: src/screen.c, src/testdir/test_listlbr_utf8.vim *** ../vim-8.0.0379/src/screen.c 2017-02-23 14:55:55.602643421 +0100 --- src/screen.c 2017-02-26 19:16:23.503358032 +0100 *************** *** 4189,4194 **** --- 4189,4196 ---- } else { + int c0; + if (p_extra_free != NULL) { vim_free(p_extra_free); *************** *** 4197,4203 **** /* * Get a character from the line itself. */ ! c = *ptr; #ifdef FEAT_MBYTE if (has_mbyte) { --- 4199,4205 ---- /* * Get a character from the line itself. */ ! c0 = c = *ptr; #ifdef FEAT_MBYTE if (has_mbyte) { *************** *** 4214,4220 **** /* Overlong encoded ASCII or ASCII with composing char * is displayed normally, except a NUL. */ if (mb_c < 0x80) ! c = mb_c; mb_utf8 = TRUE; /* At start of the line we can have a composing char. --- 4216,4222 ---- /* Overlong encoded ASCII or ASCII with composing char * is displayed normally, except a NUL. */ if (mb_c < 0x80) ! c0 = c = mb_c; mb_utf8 = TRUE; /* At start of the line we can have a composing char. *************** *** 4538,4544 **** /* * Found last space before word: check for line break. */ ! if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr)) { # ifdef FEAT_MBYTE int mb_off = has_mbyte ? (*mb_head_off)(line, ptr - 1) : 0; --- 4540,4547 ---- /* * Found last space before word: check for line break. */ ! 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; *** ../vim-8.0.0379/src/testdir/test_listlbr_utf8.vim 2017-02-05 21:14:26.743355267 +0100 --- src/testdir/test_listlbr_utf8.vim 2017-02-26 19:12:34.960813861 +0100 *************** *** 193,195 **** --- 193,222 ---- 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 *** ../vim-8.0.0379/src/version.c 2017-02-26 19:09:01.398217128 +0100 --- src/version.c 2017-02-26 19:17:48.814813913 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 380, /**/ -- If Pacman had affected us as kids we'd be running around in dark rooms, munching pills and listening to repetitive music. -- Marcus Brigstocke /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///