UI: fix cursor not displayed after hiding and un-hiding #12811

- TUI: Fix a case where the cursor was not displayed after hiding the
  cursor and then setting it to be displayed again.
- Change to reset everything before setting guicursor.

fixes #12800
close #12811

Steps to reproduce:

    nvim -u NORC
    :set termguicolors
    :hi nCursor guifg=red guibg=red
    :hi iCursor guifg=green guibg=green
    :hi cCursor guifg=blue guibg=blue
    :set guicursor=n:block-nCursor,i:hor25-iCursor,c:ver25-cCursor
    :set guicursor-=c:ver25-cCursor

Actual behaviour: Cursor is a blue vertical.
Expected behaviour: Cursor should be the default color block.
This commit is contained in:
erw7
2020-09-12 11:38:49 -07:00
committed by Justin M. Keyes
parent 1e10342382
commit 397be5d380
4 changed files with 60 additions and 20 deletions

View File

@@ -286,6 +286,21 @@ describe('ui/cursor', function()
eq(173, named.normal.blinkon)
eq(42, named.showmatch.cell_percentage)
end)
-- If there is no setting for guicursor, it becomes the default setting.
meths.set_option('guicursor', 'n:ver35-blinkwait171-blinkoff172-blinkon173-Cursor/lCursor')
screen:expect(function()
for _,m in ipairs(screen._mode_info) do
if m.name ~= 'normal' then
eq('block', m.cursor_shape or 'block')
eq(0, m.blinkon or 0)
eq(0, m.blinkoff or 0)
eq(0, m.blinkwait or 0)
eq(0, m.hl_id or 0)
eq(0, m.id_lm or 0)
end
end
end)
end)
it("empty 'guicursor' sets cursor_shape=block in all modes", function()
@@ -297,6 +312,8 @@ describe('ui/cursor', function()
if m['cursor_shape'] ~= nil then
eq('block', m.cursor_shape)
eq(0, m.blinkon)
eq(0, m.hl_id)
eq(0, m.id_lm)
end
end
end)