neovim/test/functional/terminal/api_spec.lua
Gregory Anders 0dd933265f
feat(terminal)!: cursor shape and blink (#31562)
When a terminal application running inside the terminal emulator sets
the cursor shape or blink status of the cursor, update the cursor in the
parent terminal to match.

This removes the "virtual cursor" that has been in use by the terminal
emulator since the beginning. The original rationale for using the
virtual cursor was to avoid having to support additional UI methods to
change the cursor color for other (non-TUI) UIs, instead relying on the
TermCursor and TermCursorNC highlight groups.

The TermCursor highlight group is now used in the default 'guicursor'
value, which has a new entry for Terminal mode. However, the
TermCursorNC highlight group is no longer supported: since terminal
windows now use the real cursor, when the window is not focused there is
no cursor displayed in the window at all, so there is nothing to
highlight. Users can still use the StatusLineTermNC highlight group to
differentiate non-focused terminal windows.

BREAKING CHANGE: The TermCursorNC highlight group is no longer supported.
2024-12-17 07:11:41 -06:00

85 lines
2.6 KiB
Lua

local t = require('test.testutil')
local n = require('test.functional.testnvim')()
local tt = require('test.functional.testterm')
local ok = t.ok
if t.skip(t.is_os('win')) then
return
end
describe('api', function()
local screen
local socket_name = './Xtest_functional_api.sock'
before_each(function()
n.clear()
os.remove(socket_name)
screen = tt.setup_child_nvim({
'-u',
'NONE',
'-i',
'NONE',
'--cmd',
'colorscheme vim',
'--cmd',
n.nvim_set .. ' notermguicolors',
})
end)
after_each(function()
os.remove(socket_name)
end)
it('qa! RPC request during insert-mode', function()
screen:expect {
grid = [[
^ |
{4:~ }|*4
|
{3:-- TERMINAL --} |
]],
}
-- Start the socket from the child nvim.
tt.feed_data(":echo serverstart('" .. socket_name .. "')\n")
-- Wait for socket creation.
screen:expect([[
^ |
{4:~ }|*4
]] .. socket_name .. [[ |
{3:-- TERMINAL --} |
]])
local socket_session1 = n.connect(socket_name)
local socket_session2 = n.connect(socket_name)
tt.feed_data('i[tui] insert-mode')
-- Wait for stdin to be processed.
screen:expect([[
[tui] insert-mode^ |
{4:~ }|*4
{3:-- INSERT --} |
{3:-- TERMINAL --} |
]])
ok((socket_session1:request('nvim_ui_attach', 42, 6, { rgb = true })))
ok((socket_session2:request('nvim_ui_attach', 25, 30, { rgb = true })))
socket_session1:notify('nvim_input', '\n[socket 1] this is more than 25 columns')
socket_session2:notify('nvim_input', '\n[socket 2] input')
screen:expect([[
[tui] insert-mode |
[socket 1] this is more t |
han 25 columns |
[socket 2] input^ |
{4:~ } |
{3:-- INSERT --} |
{3:-- TERMINAL --} |
]])
socket_session1:request('nvim_command', 'qa!')
end)
end)