• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Révisionbfcafd1a3e379999046d8caa65df3414328b2096 (tree)
l'heure2020-01-20 00:00:04
AuteurBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Message de Log

patch 8.2.0131: command line is not cleared when switching tabs

Commit: https://github.com/vim/vim/commit/479950f6c9aee4806f28a2b2fe5471e18a034cff
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 19 15:45:17 2020 +0100

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 #5495)

Change Summary

Modification

diff -r 3b7117916bb9 -r bfcafd1a3e37 src/testdir/dumps/Test_cmdlineclear_tabenter.dump
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/testdir/dumps/Test_cmdlineclear_tabenter.dump Sun Jan 19 16:00:04 2020 +0100
@@ -0,0 +1,10 @@
1+| +8#0000001#e0e0e08|+| |[|N|o| |N|a|m|e|]| | +2#0000000#ffffff0|[|N|o| |N|a|m|e|]| | +1&&@49|X+8#0000001#e0e0e08
2+> +0#0000000#ffffff0@74
3+|~+0#4040ff13&| @73
4+|~| @73
5+|~| @73
6+|~| @73
7+|~| @73
8+| +0#0000000&@74
9+@75
10+@57|0|,|0|-|1| @8|A|l@1|
diff -r 3b7117916bb9 -r bfcafd1a3e37 src/testdir/test_cmdline.vim
--- a/src/testdir/test_cmdline.vim Sun Jan 19 14:00:04 2020 +0100
+++ b/src/testdir/test_cmdline.vim Sun Jan 19 16:00:04 2020 +0100
@@ -905,4 +905,22 @@
905905 delfunc CmdWinType
906906 endfunc
907907
908+func Test_cmdlineclear_tabenter()
909+ CheckScreendump
910+
911+ let lines =<< trim [SCRIPT]
912+ call setline(1, range(30))
913+ [SCRIPT]
914+
915+ call writefile(lines, 'XtestCmdlineClearTabenter')
916+ let buf = RunVimInTerminal('-S XtestCmdlineClearTabenter', #{rows: 10})
917+ call term_wait(buf, 50)
918+ " in one tab make the command line higher with CTRL-W -
919+ call term_sendkeys(buf, ":tabnew\<cr>\<C-w>-\<C-w>-gtgt")
920+ call VerifyScreenDump(buf, 'Test_cmdlineclear_tabenter', {})
921+
922+ call StopVimInTerminal(buf)
923+ call delete('XtestCmdlineClearTabenter')
924+endfunc
925+
908926 " vim: shiftwidth=2 sts=2 expandtab
diff -r 3b7117916bb9 -r bfcafd1a3e37 src/version.c
--- a/src/version.c Sun Jan 19 14:00:04 2020 +0100
+++ b/src/version.c Sun Jan 19 16:00:04 2020 +0100
@@ -743,6 +743,8 @@
743743 static int included_patches[] =
744744 { /* Add new patch number below this line */
745745 /**/
746+ 131,
747+/**/
746748 130,
747749 /**/
748750 129,
diff -r 3b7117916bb9 -r bfcafd1a3e37 src/window.c
--- a/src/window.c Sun Jan 19 14:00:04 2020 +0100
+++ b/src/window.c Sun Jan 19 16:00:04 2020 +0100
@@ -4093,6 +4093,7 @@
40934093 int trigger_enter_autocmds,
40944094 int trigger_leave_autocmds)
40954095 {
4096+ int row;
40964097 int old_off = tp->tp_firstwin->w_winrow;
40974098 win_T *next_prevwin = tp->tp_prevwin;
40984099
@@ -4109,7 +4110,7 @@
41094110 prevwin = next_prevwin;
41104111
41114112 last_status(FALSE); // status line may appear or disappear
4112- (void)win_comp_pos(); // recompute w_winrow for all windows
4113+ row = win_comp_pos(); // recompute w_winrow for all windows
41134114 #ifdef FEAT_DIFF
41144115 diff_need_scrollbind = TRUE;
41154116 #endif
@@ -4121,6 +4122,13 @@
41214122 if (p_ch != curtab->tp_ch_used)
41224123 clear_cmdline = TRUE;
41234124 p_ch = curtab->tp_ch_used;
4125+
4126+ // When cmdheight is changed in a tab page with '<C-w>-', cmdline_row is
4127+ // changed but p_ch and tp_ch_used are not changed. Thus we also need to
4128+ // check cmdline_row.
4129+ if ((row < cmdline_row) && (cmdline_row <= Rows - p_ch))
4130+ clear_cmdline = TRUE;
4131+
41244132 if (curtab->tp_old_Rows != Rows || (old_off != firstwin->w_winrow
41254133 #ifdef FEAT_GUI_TABLINE
41264134 && !gui_use_tabline()
Afficher sur ancien navigateur de dépôt.