Problem: Listchars aintain their SpecialKey highlighting when within a visual selection, unlike regular text which adopts Visual highlighting.
Solution: Remove attr_pri restriction in attribute combination logic to allow listchars display in visual mode, combining extra_attr with existing char_attr when visual selection is active.
relate neovim/neovim#34189
https://github.com/vim/vim/pull/18167
(3 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@zeertzjq commented on this pull request.
In src/testdir/test_highlight.vim:
> @@ -1355,4 +1355,21 @@ func Test_hlset()
call assert_true(hlget('hlg11')[0].cleared)
endfunc
+func Test_listchars_with_visual()
Put this in test_listchars.vim?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@h-east commented on this pull request.
In src/drawline.c:
> + {
+ wlv.char_attr = hl_combine_attr(wlv.char_attr, wlv.extra_attr);
+ }
The curly braces seems unnecessary.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@zeertzjq commented on this pull request.
In src/drawline.c:
> else
+ {
+#ifdef LINE_ATTR
+ // Visual mode: combine listchars with visual selection color
This comment doesn't seem to belong here.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@zeertzjq commented on this pull request.
In src/drawline.c:
> else
+ {
+#ifdef LINE_ATTR
+ // Visual mode: combine listchars with visual selection color
This comment doesn't seem to belong here. Visual selection highlighting isn't included in either line_attr or extra_attr.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@glepnir pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@glepnir commented on this pull request.
In src/drawline.c:
> else
+ {
+#ifdef LINE_ATTR
+ // Visual mode: combine listchars with visual selection color
yep forget remove
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Looks good for Visual with no foreground defined:
image.png (view on web) image.png (view on web)Looks bad for visual with foreground defined and reverse:
image.png (view on web) image.png (view on web) image.png (view on web)—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
'listchars' are only displayed during Visual mode within the selected area
This will complicate the size computation of TABs and the cursor positioning on TABs, as they depend on whether 'list' and 'listchars' tab field are used, and with this 'visuallist' they'll have to depend on whether the TAB is in the Visual selection as well. And if the Visual selection only covers a part of a TAB (in blockwise mode), things may get even more complicated.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Yes. The previous change altered the merge priority. The original issue has been updated to request supporting listchars only when in Visual mode. Currently, a new option visuallist has been added (a better name would be welcome) that shows the selected area's listchars only when in Visual mode, using the VisualSpecialKey highlight group. Sorry, I collapsed your comment — there were a bit too many images, which made browsing here quite lengthy.. there are some uncertain parts… I might need you to take a look and help @zeertzjq
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
'listchars' are only displayed during Visual mode within the selected area
This will complicate the size computation of TABs and the cursor positioning on TABs, as they depend on whether 'list' and 'listchars' tab field are used, and with this 'visuallist' they'll have to depend on whether the TAB is in the Visual selection as well. And if the (blockwise) Visual selection only covers a part of a TAB, things may get even more complicated.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Lol, your reply was so fast that I hadn’t refreshed the page yet. Wouldn’t it be enough to just control a variable and attribute for whether to render listchars? No other calculations need to be changed.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Wouldn’t it be enough to just control a variable and attribute for whether to render listchars?
No. Because
'list' is set and tab isn't present in 'listchars', a TAB is rendered as ^I or <09>.'list' is set, cursor is placed on the first cell on the TAB, otherwise it's placed on the last cell.So if you change whether 'list' is applied to depend on the Visual selection, these will have to depend on the Visual selection as well.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
'listchars' are only displayed during Visual mode within the selected area
This will complicate the size computation of TABs and the cursor positioning on TABs, as they depend on whether
'list'and'listchars'tabfield are used, and with this'visuallist'they'll have to depend on whether the TAB is in the Visual selection as well. And if the (blockwise) Visual selection only covers a part of a TAB, things may get even more complicated.
That is what I was thinking looking at the updated docs here in PR.
What would happen to those partial tabs in blockwise selection?
image.png (view on web)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Thanks. I’ll try these cases ..
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Isn't this something that could be achieved using a ModeChanged autocommand?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
this has stalled, so closing
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()