Visual: highlight char-at-cursor

Decide whether to highlight the visual-selected character under the
cursor, depending on 'guicursor' style:

- Highlight if cursor is blinking or non-block (vertical, horiz).
- Do NOT highlight if cursor is non-blinking block.

Traditionally Vim's visual selection does "reverse mode", which perhaps
conflicts with the non-blinking block cursor. But 'guicursor' defaults
to a vertical bar for selection=exclusive, and this confuses users who
expect to see the text highlighted.

closes #8983
This commit is contained in:
Justin M. Keyes
2019-01-03 00:09:35 +01:00
parent e2d71d11de
commit 37a499148f
5 changed files with 62 additions and 13 deletions

View File

@@ -322,6 +322,40 @@ describe('highlight', function()
screen:attach()
end)
it('visual', function()
screen:detach()
screen = Screen.new(20,4)
screen:attach()
screen:set_default_attr_ids({
[1] = {background = Screen.colors.LightGrey},
[2] = {bold = true, foreground = Screen.colors.Blue1},
[3] = {bold = true},
})
insert([[
line1 foo bar
]])
-- Non-blinking block cursor: does NOT highlight char-at-cursor.
command('set guicursor=a:block-blinkon0')
feed('gg$vhhh')
screen:expect([[
line1 foo^ {1:bar} |
|
{2:~ }|
{3:-- VISUAL --} |
]])
-- Vertical cursor: highlights char-at-cursor. #8983
command('set guicursor=a:block-blinkon175')
feed('<esc>gg$vhhh')
screen:expect([[
line1 foo{1:^ bar} |
|
{2:~ }|
{3:-- VISUAL --} |
]])
end)
it('cterm=standout gui=standout', function()
screen:detach()
screen = Screen.new(20,5)