mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.0131: command line is not cleared when switching tabs
Problem: Command line is not cleared when switching tabs and the command
line height differs.
Solution: Set the "clear_cmdline" flag when needed. (Naruhiko Nishino,
closes vim/vim#5495)
479950f6c9
This commit is contained in:
parent
5329cb2e5c
commit
3d6584223d
@ -722,7 +722,7 @@ func Test_verbosefile()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_verbose_option()
|
func Test_verbose_option()
|
||||||
" See test/functional/ui/cmdline_spec.lua
|
" See test/functional/legacy/cmdline_spec.lua
|
||||||
CheckScreendump
|
CheckScreendump
|
||||||
|
|
||||||
let lines =<< trim [SCRIPT]
|
let lines =<< trim [SCRIPT]
|
||||||
@ -842,6 +842,25 @@ func Test_buffers_lastused()
|
|||||||
bwipeout bufc
|
bwipeout bufc
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_cmdlineclear_tabenter()
|
||||||
|
" See test/functional/legacy/cmdline_spec.lua
|
||||||
|
CheckScreendump
|
||||||
|
|
||||||
|
let lines =<< trim [SCRIPT]
|
||||||
|
call setline(1, range(30))
|
||||||
|
[SCRIPT]
|
||||||
|
|
||||||
|
call writefile(lines, 'XtestCmdlineClearTabenter')
|
||||||
|
let buf = RunVimInTerminal('-S XtestCmdlineClearTabenter', #{rows: 10})
|
||||||
|
call term_wait(buf, 50)
|
||||||
|
" in one tab make the command line higher with CTRL-W -
|
||||||
|
call term_sendkeys(buf, ":tabnew\<cr>\<C-w>-\<C-w>-gtgt")
|
||||||
|
call VerifyScreenDump(buf, 'Test_cmdlineclear_tabenter', {})
|
||||||
|
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
call delete('XtestCmdlineClearTabenter')
|
||||||
|
endfunc
|
||||||
|
|
||||||
" test that ";" works to find a match at the start of the first line
|
" test that ";" works to find a match at the start of the first line
|
||||||
func Test_zero_line_search()
|
func Test_zero_line_search()
|
||||||
new
|
new
|
||||||
|
@ -4049,7 +4049,7 @@ static void enter_tabpage(tabpage_T *tp, buf_T *old_curbuf, int trigger_enter_au
|
|||||||
prevwin = next_prevwin;
|
prevwin = next_prevwin;
|
||||||
|
|
||||||
last_status(false); // status line may appear or disappear
|
last_status(false); // status line may appear or disappear
|
||||||
(void)win_comp_pos(); // recompute w_winrow for all windows
|
const int row = win_comp_pos(); // recompute w_winrow for all windows
|
||||||
diff_need_scrollbind = true;
|
diff_need_scrollbind = true;
|
||||||
|
|
||||||
/* The tabpage line may have appeared or disappeared, may need to resize
|
/* The tabpage line may have appeared or disappeared, may need to resize
|
||||||
@ -4060,11 +4060,20 @@ static void enter_tabpage(tabpage_T *tp, buf_T *old_curbuf, int trigger_enter_au
|
|||||||
clear_cmdline = true;
|
clear_cmdline = true;
|
||||||
}
|
}
|
||||||
p_ch = curtab->tp_ch_used;
|
p_ch = curtab->tp_ch_used;
|
||||||
if (curtab->tp_old_Rows != Rows || (old_off != firstwin->w_winrow
|
|
||||||
))
|
// When cmdheight is changed in a tab page with '<C-w>-', cmdline_row is
|
||||||
|
// changed but p_ch and tp_ch_used are not changed. Thus we also need to
|
||||||
|
// check cmdline_row.
|
||||||
|
if ((row < cmdline_row) && (cmdline_row <= Rows - p_ch)) {
|
||||||
|
clear_cmdline = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (curtab->tp_old_Rows != Rows || (old_off != firstwin->w_winrow)) {
|
||||||
shell_new_rows();
|
shell_new_rows();
|
||||||
if (curtab->tp_old_Columns != Columns && starting == 0)
|
}
|
||||||
shell_new_columns(); /* update window widths */
|
if (curtab->tp_old_Columns != Columns && starting == 0) {
|
||||||
|
shell_new_columns(); // update window widths
|
||||||
|
}
|
||||||
|
|
||||||
lastused_tabpage = old_curtab;
|
lastused_tabpage = old_curtab;
|
||||||
|
|
||||||
|
66
test/functional/legacy/cmdline_spec.lua
Normal file
66
test/functional/legacy/cmdline_spec.lua
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
|
local Screen = require('test.functional.ui.screen')
|
||||||
|
local clear = helpers.clear
|
||||||
|
local feed = helpers.feed
|
||||||
|
local feed_command = helpers.feed_command
|
||||||
|
local source = helpers.source
|
||||||
|
|
||||||
|
describe('cmdline', function()
|
||||||
|
before_each(clear)
|
||||||
|
|
||||||
|
it('is cleared when switching tabs', function()
|
||||||
|
local screen = Screen.new(30, 10)
|
||||||
|
screen:attach()
|
||||||
|
feed_command([[call setline(1, range(30))]])
|
||||||
|
screen:expect([[
|
||||||
|
^0 |
|
||||||
|
1 |
|
||||||
|
2 |
|
||||||
|
3 |
|
||||||
|
4 |
|
||||||
|
5 |
|
||||||
|
6 |
|
||||||
|
7 |
|
||||||
|
8 |
|
||||||
|
:call setline(1, range(30)) |
|
||||||
|
]])
|
||||||
|
feed([[:tabnew<cr><C-w>-<C-w>-gtgt]])
|
||||||
|
screen:expect([[
|
||||||
|
+ [No Name] [No Name] X|
|
||||||
|
^ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
6 |
|
||||||
|
7 |
|
||||||
|
|
|
||||||
|
]])
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('prints every executed Ex command if verbose >= 16', function()
|
||||||
|
local screen = Screen.new(60, 12)
|
||||||
|
screen:attach()
|
||||||
|
source([[
|
||||||
|
command DoSomething echo 'hello' |set ts=4 |let v = '123' |echo v
|
||||||
|
call feedkeys("\r", 't') " for the hit-enter prompt
|
||||||
|
set verbose=20
|
||||||
|
]])
|
||||||
|
feed_command('DoSomething')
|
||||||
|
screen:expect([[
|
||||||
|
|
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
|
|
||||||
|
Executing: DoSomething |
|
||||||
|
Executing: echo 'hello' |set ts=4 |let v = '123' |echo v |
|
||||||
|
hello |
|
||||||
|
Executing: set ts=4 |let v = '123' |echo v |
|
||||||
|
Executing: let v = '123' |echo v |
|
||||||
|
Executing: echo v |
|
||||||
|
123 |
|
||||||
|
Press ENTER or type command to continue^ |
|
||||||
|
]])
|
||||||
|
end)
|
||||||
|
end)
|
@ -3,7 +3,6 @@ local Screen = require('test.functional.ui.screen')
|
|||||||
local clear, feed = helpers.clear, helpers.feed
|
local clear, feed = helpers.clear, helpers.feed
|
||||||
local source = helpers.source
|
local source = helpers.source
|
||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
local feed_command = helpers.feed_command
|
|
||||||
|
|
||||||
local function new_screen(opt)
|
local function new_screen(opt)
|
||||||
local screen = Screen.new(25, 5)
|
local screen = Screen.new(25, 5)
|
||||||
@ -843,34 +842,3 @@ describe('cmdline redraw', function()
|
|||||||
]], unchanged=true}
|
]], unchanged=true}
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('cmdline', function()
|
|
||||||
before_each(function()
|
|
||||||
clear()
|
|
||||||
end)
|
|
||||||
|
|
||||||
it('prints every executed Ex command if verbose >= 16', function()
|
|
||||||
local screen = Screen.new(50, 12)
|
|
||||||
screen:attach()
|
|
||||||
source([[
|
|
||||||
command DoSomething echo 'hello' |set ts=4 |let v = '123' |echo v
|
|
||||||
call feedkeys("\r", 't') " for the hit-enter prompt
|
|
||||||
set verbose=20
|
|
||||||
]])
|
|
||||||
feed_command('DoSomething')
|
|
||||||
screen:expect([[
|
|
||||||
|
|
|
||||||
~ |
|
|
||||||
|
|
|
||||||
Executing: DoSomething |
|
|
||||||
Executing: echo 'hello' |set ts=4 |let v = '123' ||
|
|
||||||
echo v |
|
|
||||||
hello |
|
|
||||||
Executing: set ts=4 |let v = '123' |echo v |
|
|
||||||
Executing: let v = '123' |echo v |
|
|
||||||
Executing: echo v |
|
|
||||||
123 |
|
|
||||||
Press ENTER or type command to continue^ |
|
|
||||||
]])
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user