Skip to content

Commit

Permalink
patch 8.0.1767: with 'incsearch' text may jump up and down
Browse files Browse the repository at this point in the history
Problem:    With 'incsearch' text may jump up and down. ()
Solution:   Besides w_botline also save and restore w_empty_rows.
            (closes # 2530)
  • Loading branch information
brammool committed Apr 27, 2018
1 parent c3c3e69 commit 9d34d90
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/ex_getln.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,9 @@ getcmdline(
int old_topfill;
int init_topfill = curwin->w_topfill;
# endif
linenr_T old_botline;
linenr_T old_botline, old_empty_rows;
linenr_T init_botline = curwin->w_botline;
linenr_T init_empty_rows = curwin->w_empty_rows;
int did_incsearch = FALSE;
int incsearch_postponed = FALSE;
#endif
Expand Down Expand Up @@ -291,6 +292,7 @@ getcmdline(
old_topfill = curwin->w_topfill;
# endif
old_botline = curwin->w_botline;
old_empty_rows = curwin->w_empty_rows;
#endif

/*
Expand Down Expand Up @@ -1075,6 +1077,7 @@ getcmdline(
old_topfill = init_topfill;
# endif
old_botline = init_botline;
old_empty_rows = init_empty_rows;
}
#endif
redrawcmd();
Expand Down Expand Up @@ -1804,6 +1807,7 @@ getcmdline(
old_topfill = curwin->w_topfill;
# endif
old_botline = curwin->w_botline;
old_empty_rows = curwin->w_empty_rows;
update_screen(NOT_VALID);
redrawcmdline();
}
Expand Down Expand Up @@ -2020,6 +2024,7 @@ getcmdline(
curwin->w_topfill = old_topfill;
# endif
curwin->w_botline = old_botline;
curwin->w_empty_rows = old_empty_rows;
changed_cline_bef_curs();
update_topline();

Expand Down Expand Up @@ -2114,6 +2119,7 @@ getcmdline(
curwin->w_topfill = old_topfill;
# endif
curwin->w_botline = old_botline;
curwin->w_empty_rows = old_empty_rows;
highlight_match = FALSE;
validate_cursor(); /* needed for TAB */
redraw_all_later(SOME_VALID);
Expand Down
9 changes: 9 additions & 0 deletions src/testdir/dumps/Test_incsearch_scrolling_01.dump
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
|.+0&#ffffff0@69
@50| @19
|.@69
@50| @19
@70
|t+1&&|a|r|g|e+0&&|t| @63
|@+0#4040ff13&@2| @66
|/+0#0000000&|t|a|r|g> @64
@70
31 changes: 31 additions & 0 deletions src/testdir/test_search.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
" Test for the search command

source shared.vim
source screendump.vim

func Test_search_cmdline()
if !exists('+incsearch')
Expand Down Expand Up @@ -690,6 +691,36 @@ func Test_search_cmdline_incsearch_highlight_attr()
bwipe!
endfunc

func Test_incsearch_scrolling()
if !CanRunVimInTerminal()
return
endif
call assert_equal(0, &scrolloff)
call writefile([
\ 'let dots = repeat(".", 120)',
\ 'set incsearch cmdheight=2 scrolloff=0',
\ 'call setline(1, [dots, dots, dots, "", "target", dots, dots])',
\ 'normal gg',
\ 'redraw',
\ ], 'Xscript')
let buf = RunVimInTerminal('-S Xscript', {'rows': 9, 'cols': 70})
" Need to send one key at a time to force a redraw
call term_sendkeys(buf, '/')
sleep 100m
call term_sendkeys(buf, 't')
sleep 100m
call term_sendkeys(buf, 'a')
sleep 100m
call term_sendkeys(buf, 'r')
sleep 100m
call term_sendkeys(buf, 'g')
call VerifyScreenDump(buf, 'Test_incsearch_scrolling_01', {})

call term_sendkeys(buf, "\<Esc>")
call StopVimInTerminal(buf)
call delete('Xscript')
endfunc

func Test_search_undefined_behaviour()
if !has("terminal")
return
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1767,
/**/
1766,
/**/
Expand Down

0 comments on commit 9d34d90

Please sign in to comment.