refactor(terminal): move :terminal defaults to _defaults.lua

This commit is contained in:
Gregory Anders
2024-06-11 11:10:34 -05:00
parent 3e09fbdf82
commit d38912b59f
9 changed files with 50 additions and 29 deletions

View File

@@ -196,10 +196,10 @@ describe(':terminal buffer', function()
screen:expect([[
ab^c |
{4:~ }|
{5:========== }|
{17:========== }|
rows: 2, cols: 50 |
{2: } |
{1:========== }|
{18:========== }|
|
]])
@@ -340,7 +340,7 @@ describe(':terminal buffer', function()
eq(termbuf, eval('g:termbuf'))
end)
it('TermReqeust synchronization #27572', function()
it('TermRequest synchronization #27572', function()
command('autocmd! nvim_terminal TermRequest')
local term = exec_lua([[
_G.input = {}

View File

@@ -14,10 +14,12 @@ describe(':terminal mouse', function()
before_each(function()
clear()
api.nvim_set_option_value('statusline', '==========', {})
command('highlight StatusLine cterm=NONE')
command('highlight StatusLineNC cterm=NONE')
command('highlight VertSplit cterm=NONE')
screen = tt.screen_setup()
command('highlight StatusLine NONE')
command('highlight StatusLineNC NONE')
command('highlight StatusLineTerm NONE')
command('highlight StatusLineTermNC NONE')
command('highlight VertSplit NONE')
local lines = {}
for i = 1, 30 do
table.insert(lines, 'line' .. tostring(i))

View File

@@ -92,6 +92,8 @@ local function screen_setup(extra_rows, command, cols, env, screen_opts)
api.nvim_command('highlight TermCursor cterm=reverse')
api.nvim_command('highlight TermCursorNC ctermbg=11')
api.nvim_command('highlight StatusLineTerm ctermbg=2 ctermfg=0')
api.nvim_command('highlight StatusLineTermNC ctermbg=2 ctermfg=8')
local screen = Screen.new(cols, 7 + extra_rows)
screen:set_default_attr_ids({
@@ -111,6 +113,8 @@ local function screen_setup(extra_rows, command, cols, env, screen_opts)
[14] = { underline = true, reverse = true, bold = true },
[15] = { underline = true, foreground = 12 },
[16] = { background = 248, foreground = 0 }, -- Visual in :terminal session
[17] = { background = 2, foreground = 0 }, -- StatusLineTerm
[18] = { background = 2, foreground = 8 }, -- StatusLineTermNC
})
screen:attach(screen_opts or { rgb = false })

View File

@@ -22,10 +22,12 @@ describe(':terminal', function()
-- set the statusline to a constant value because of variables like pid
-- and current directory and to improve visibility of splits
api.nvim_set_option_value('statusline', '==========', {})
command('highlight StatusLine cterm=NONE')
command('highlight StatusLineNC cterm=NONE')
command('highlight VertSplit cterm=NONE')
screen = tt.screen_setup(3)
command('highlight StatusLine NONE')
command('highlight StatusLineNC NONE')
command('highlight StatusLineTerm NONE')
command('highlight StatusLineTermNC NONE')
command('highlight VertSplit NONE')
end)
after_each(function()