fix(terminal): set local values of window options (#29326)

This commit is contained in:
zeertzjq 2024-06-14 06:20:42 +08:00 committed by GitHub
parent 4a24940980
commit 5def8714ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 24 additions and 4 deletions

View File

@ -290,15 +290,15 @@ do
vim.bo.undolevels = -1 vim.bo.undolevels = -1
vim.bo.scrollback = vim.o.scrollback < 0 and 10000 or math.max(1, vim.o.scrollback) vim.bo.scrollback = vim.o.scrollback < 0 and 10000 or math.max(1, vim.o.scrollback)
vim.bo.textwidth = 0 vim.bo.textwidth = 0
vim.wo.wrap = false vim.wo[0][0].wrap = false
vim.wo.list = false vim.wo[0][0].list = false
-- This is gross. Proper list options support when? -- This is gross. Proper list options support when?
local winhl = vim.o.winhighlight local winhl = vim.o.winhighlight
if winhl ~= '' then if winhl ~= '' then
winhl = winhl .. ',' winhl = winhl .. ','
end end
vim.wo.winhighlight = winhl .. 'StatusLine:StatusLineTerm,StatusLineNC:StatusLineTermNC' vim.wo[0][0].winhighlight = winhl .. 'StatusLine:StatusLineTerm,StatusLineNC:StatusLineTermNC'
end, end,
}) })

View File

@ -196,7 +196,7 @@ describe(':terminal buffer', function()
screen:expect([[ screen:expect([[
ab^c | ab^c |
{4:~ }| {4:~ }|
{17:========== }| {5:========== }|
rows: 2, cols: 50 | rows: 2, cols: 50 |
{2: } | {2: } |
{18:========== }| {18:========== }|

View File

@ -12,6 +12,26 @@ local eval = n.eval
local skip = t.skip local skip = t.skip
local is_os = t.is_os local is_os = t.is_os
describe(':terminal window', function()
before_each(clear)
it('sets local values of window options #29325', function()
command('setglobal wrap list')
command('terminal')
eq({ 0, 0, 1 }, eval('[&l:wrap, &wrap, &g:wrap]'))
eq({ 0, 0, 1 }, eval('[&l:list, &list, &g:list]'))
command('enew')
eq({ 1, 1, 1 }, eval('[&l:wrap, &wrap, &g:wrap]'))
eq({ 1, 1, 1 }, eval('[&l:list, &list, &g:list]'))
command('buffer #')
eq({ 0, 0, 1 }, eval('[&l:wrap, &wrap, &g:wrap]'))
eq({ 0, 0, 1 }, eval('[&l:list, &list, &g:list]'))
command('new')
eq({ 1, 1, 1 }, eval('[&l:wrap, &wrap, &g:wrap]'))
eq({ 1, 1, 1 }, eval('[&l:list, &list, &g:list]'))
end)
end)
describe(':terminal window', function() describe(':terminal window', function()
local screen local screen