mirror of
https://github.com/neovim/neovim
synced 2025-07-17 01:31:48 +00:00
fix(terminal): check size when switching buffers
Problem: terminal not always resized when switching to its buffer.
Solution: add missing calls to terminal_check_size.
Adjust screen test for v0.11.
(cherry picked from commit e56292071a
)
This commit is contained in:
committed by
github-actions[bot]
parent
fd8e0ae62d
commit
8daffd0cbb
@ -1772,6 +1772,10 @@ void enter_buffer(buf_T *buf)
|
|||||||
}
|
}
|
||||||
curbuf->b_last_used = time(NULL);
|
curbuf->b_last_used = time(NULL);
|
||||||
|
|
||||||
|
if (curbuf->terminal != NULL) {
|
||||||
|
terminal_check_size(curbuf->terminal);
|
||||||
|
}
|
||||||
|
|
||||||
redraw_later(curwin, UPD_NOT_VALID);
|
redraw_later(curwin, UPD_NOT_VALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2726,6 +2726,9 @@ theend:
|
|||||||
if (bufref_valid(&old_curbuf) && old_curbuf.br_buf->terminal != NULL) {
|
if (bufref_valid(&old_curbuf) && old_curbuf.br_buf->terminal != NULL) {
|
||||||
terminal_check_size(old_curbuf.br_buf->terminal);
|
terminal_check_size(old_curbuf.br_buf->terminal);
|
||||||
}
|
}
|
||||||
|
if ((!bufref_valid(&old_curbuf) || curbuf != old_curbuf.br_buf) && curbuf->terminal != NULL) {
|
||||||
|
terminal_check_size(curbuf->terminal);
|
||||||
|
}
|
||||||
|
|
||||||
if (did_inc_redrawing_disabled) {
|
if (did_inc_redrawing_disabled) {
|
||||||
RedrawingDisabled--;
|
RedrawingDisabled--;
|
||||||
|
@ -322,6 +322,27 @@ describe(':terminal buffer', function()
|
|||||||
eq({ mode = 'nt', blocking = false }, api.nvim_get_mode())
|
eq({ mode = 'nt', blocking = false }, api.nvim_get_mode())
|
||||||
command('bd!')
|
command('bd!')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('correct size when switching buffers', function()
|
||||||
|
local term_buf = api.nvim_get_current_buf()
|
||||||
|
command('file foo | enew | vsplit')
|
||||||
|
api.nvim_set_current_buf(term_buf)
|
||||||
|
screen:expect([[
|
||||||
|
tty ready │ |
|
||||||
|
^rows: 5, cols: 25 │{4:~ }|
|
||||||
|
│{4:~ }|*3
|
||||||
|
{17:foo }{1:[No Name] }|
|
||||||
|
|
|
||||||
|
]])
|
||||||
|
|
||||||
|
feed('<C-^><C-W><C-O><C-^>')
|
||||||
|
screen:expect([[
|
||||||
|
tty ready |
|
||||||
|
^rows: 5, cols: 25 |
|
||||||
|
rows: 6, cols: 50 |
|
||||||
|
|*4
|
||||||
|
]])
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe(':terminal buffer', function()
|
describe(':terminal buffer', function()
|
||||||
|
Reference in New Issue
Block a user