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('<a' .. repeat('b', &columns - 4) .. 'c', Screenline(1))
+ call assert_equal(attr_TabLineFill, screenattr(1, &columns - 2))
+ call assert_equal(attr_TabLine, screenattr(1, &columns - 1))
+ call assert_equal(attr_TabLine, screenattr(1, &columns))
+
+ bw!
+ set tabline=
+ endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.1671/src/version.c 2023-06-28 23:26:32.358197450 +0100
--- src/version.c 2023-07-01 19:57:38.214745396 +0100
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1672,
/**/
--
hundred-and-one symptoms of being an internet addict:
261. You find diskettes in your pockets when doing laundry.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20230701192550.5CAD21C040B%40moolenaar.net.