To: vim_dev@googlegroups.com Subject: Patch 9.0.1672 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1672 Problem: Tabline highlight wrong after truncated double width label. Solution: Fill up half a double width character later. (closes #12614) Files: src/buffer.c, src/testdir/test_tabline.vim *** ../vim-9.0.1671/src/buffer.c 2023-05-27 18:02:50.188062442 +0100 --- src/buffer.c 2023-07-01 19:55:49.286731728 +0100 *************** *** 502,508 **** * It can be: * 0 buffer becomes hidden * DOBUF_UNLOAD buffer is unloaded ! * DOBUF_DELETE buffer is unloaded and removed from buffer list * DOBUF_WIPE buffer is unloaded and really deleted * DOBUF_WIPE_REUSE idem, and add to buf_reuse list * When doing all but the first one on the current buffer, the caller should --- 502,508 ---- * It can be: * 0 buffer becomes hidden * DOBUF_UNLOAD buffer is unloaded ! * DOBUF_DEL buffer is unloaded and removed from buffer list * DOBUF_WIPE buffer is unloaded and really deleted * DOBUF_WIPE_REUSE idem, and add to buf_reuse list * When doing all but the first one on the current buffer, the caller should *************** *** 5108,5121 **** STRMOVE(s + 1, p); *s = '<'; - // Fill up for half a double-wide character. - while (++width < maxwidth) - { - s = s + STRLEN(s); - MB_CHAR2BYTES(fillchar, s); - *s = NUL; - } - --n; // count the '<' for (; l < itemcnt; l++) { --- 5108,5113 ---- *************** *** 5124,5129 **** --- 5116,5129 ---- else stl_items[l].stl_start = s; } + + // Fill up for half a double-wide character. + while (++width < maxwidth) + { + s = s + STRLEN(s); + MB_CHAR2BYTES(fillchar, s); + *s = NUL; + } } width = maxwidth; } *** ../vim-9.0.1671/src/testdir/test_tabline.vim 2023-01-14 11:46:09.704717821 +0000 --- src/testdir/test_tabline.vim 2023-07-01 19:55:49.286731728 +0100 *************** *** 133,139 **** tabnew redraw! ! tabclose set tabline= endfunc --- 133,139 ---- tabnew redraw! ! bw! set tabline= endfunc *************** *** 202,205 **** --- 202,229 ---- call StopVimInTerminal(buf) endfunc + func TruncTabLine() + return '%1T口口%2Ta' .. repeat('b', &columns - 4) .. '%999X%#TabLine#c' + endfunc + + " Test 'tabline' with truncated double-width label at the start. + func Test_tabline_truncated_double_width() + tabnew + redraw + call assert_match('X$', Screenline(1)) + let attr_TabLineFill = screenattr(1, &columns - 1) + let attr_TabLine = screenattr(1, &columns) + call assert_notequal(attr_TabLine, attr_TabLineFill) + + set tabline=%!TruncTabLine() + redraw + call assert_equal('