mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(terminal): skip aucmd_win when checking terminal size (#19668)
This commit is contained in:
parent
fa8b2b4c50
commit
629169462a
@ -367,7 +367,12 @@ void terminal_check_size(Terminal *term)
|
|||||||
vterm_get_size(term->vt, &curheight, &curwidth);
|
vterm_get_size(term->vt, &curheight, &curwidth);
|
||||||
uint16_t width = 0, height = 0;
|
uint16_t width = 0, height = 0;
|
||||||
|
|
||||||
|
// Check if there is a window that displays the terminal and find the maximum width and height.
|
||||||
|
// Skip the autocommand window which isn't actually displayed.
|
||||||
FOR_ALL_TAB_WINDOWS(tp, wp) {
|
FOR_ALL_TAB_WINDOWS(tp, wp) {
|
||||||
|
if (wp == aucmd_win) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (wp->w_buffer && wp->w_buffer->terminal == term) {
|
if (wp->w_buffer && wp->w_buffer->terminal == term) {
|
||||||
const uint16_t win_width =
|
const uint16_t win_width =
|
||||||
(uint16_t)(MAX(0, wp->w_width_inner - win_col_off(wp)));
|
(uint16_t)(MAX(0, wp->w_width_inner - win_col_off(wp)));
|
||||||
|
@ -2,12 +2,14 @@ local helpers = require('test.functional.helpers')(after_each)
|
|||||||
local thelpers = require('test.functional.terminal.helpers')
|
local thelpers = require('test.functional.terminal.helpers')
|
||||||
local assert_alive = helpers.assert_alive
|
local assert_alive = helpers.assert_alive
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local feed, nvim = helpers.feed, helpers.nvim
|
local feed = helpers.feed
|
||||||
local feed_command = helpers.feed_command
|
local feed_command = helpers.feed_command
|
||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
|
local meths = helpers.meths
|
||||||
local iswin = helpers.iswin
|
local iswin = helpers.iswin
|
||||||
|
local sleep = helpers.sleep
|
||||||
local retry = helpers.retry
|
local retry = helpers.retry
|
||||||
|
|
||||||
describe(':terminal', function()
|
describe(':terminal', function()
|
||||||
@ -17,10 +19,10 @@ describe(':terminal', function()
|
|||||||
clear()
|
clear()
|
||||||
-- set the statusline to a constant value because of variables like pid
|
-- set the statusline to a constant value because of variables like pid
|
||||||
-- and current directory and to improve visibility of splits
|
-- and current directory and to improve visibility of splits
|
||||||
nvim('set_option', 'statusline', '==========')
|
meths.set_option('statusline', '==========')
|
||||||
nvim('command', 'highlight StatusLine cterm=NONE')
|
command('highlight StatusLine cterm=NONE')
|
||||||
nvim('command', 'highlight StatusLineNC cterm=NONE')
|
command('highlight StatusLineNC cterm=NONE')
|
||||||
nvim('command', 'highlight VertSplit cterm=NONE')
|
command('highlight VertSplit cterm=NONE')
|
||||||
screen = thelpers.screen_setup(3)
|
screen = thelpers.screen_setup(3)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -68,6 +70,27 @@ describe(':terminal', function()
|
|||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('does not change size if updated when not visible in any window #19665', function()
|
||||||
|
local channel = meths.buf_get_option(0, 'channel')
|
||||||
|
command('enew')
|
||||||
|
sleep(100)
|
||||||
|
meths.chan_send(channel, 'foo')
|
||||||
|
sleep(100)
|
||||||
|
command('bprevious')
|
||||||
|
screen:expect([[
|
||||||
|
tty ready |
|
||||||
|
^foo{2: } |
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
]])
|
||||||
|
end)
|
||||||
|
|
||||||
it('forwards resize request to the program', function()
|
it('forwards resize request to the program', function()
|
||||||
feed([[<C-\><C-N>G]])
|
feed([[<C-\><C-N>G]])
|
||||||
local w1, h1 = screen._width - 3, screen._height - 2
|
local w1, h1 = screen._width - 3, screen._height - 2
|
||||||
|
Loading…
Reference in New Issue
Block a user