Skip to content

Commit 1d669c2

Browse files
committed
patch 8.0.0172: command line window does not work
Problem: The command selected in the command line window is not executed. (Andrey Starodubtsev) Solution: Save and restore the command line at a lower level. (closes #1370)
1 parent ee142ad commit 1d669c2

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

src/ex_getln.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -773,9 +773,7 @@ getcmdline(
773773
/*
774774
* Open a window to edit the command line (and history).
775775
*/
776-
save_cmdline(&save_ccline);
777776
c = ex_window();
778-
restore_cmdline(&save_ccline);
779777
some_key_typed = TRUE;
780778
}
781779
}
@@ -6904,9 +6902,7 @@ ex_window(void)
69046902
redraw_later(SOME_VALID);
69056903

69066904
/* Save the command line info, can be used recursively. */
6907-
save_ccline = ccline;
6908-
ccline.cmdbuff = NULL;
6909-
ccline.cmdprompt = NULL;
6905+
save_cmdline(&save_ccline);
69106906

69116907
/* No Ex mode here! */
69126908
exmode_active = 0;
@@ -6953,7 +6949,7 @@ ex_window(void)
69536949
# endif
69546950

69556951
/* Restore the command line info. */
6956-
ccline = save_ccline;
6952+
restore_cmdline(&save_ccline);
69576953
cmdwin_type = 0;
69586954

69596955
exmode_active = save_exmode;

src/testdir/test_history.vim

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,20 @@ function Test_History()
8787
call assert_equal(-1, histnr('abc'))
8888
call assert_fails('call histnr([])', 'E730:')
8989
endfunction
90+
91+
function Test_Search_history_window()
92+
new
93+
call setline(1, ['a', 'b', 'a', 'b'])
94+
1
95+
call feedkeys("/a\<CR>", 'xt')
96+
call assert_equal('a', getline('.'))
97+
1
98+
call feedkeys("/b\<CR>", 'xt')
99+
call assert_equal('b', getline('.'))
100+
1
101+
" select the previous /a command
102+
call feedkeys("q/kk\<CR>", 'x!')
103+
call assert_equal('a', getline('.'))
104+
call assert_equal('a', @/)
105+
bwipe!
106+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
172,
767769
/**/
768770
171,
769771
/**/

0 commit comments

Comments
 (0)