0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.2.1488: text does not scroll when inserting above first line

Problem:    Text does not scroll when inserting above first line.
Solution:   Adjust off-by-one error. (Ken Takata, closes #6739)
This commit is contained in:
Bram Moolenaar
2020-08-19 20:19:48 +02:00
parent a7c4e74763
commit 9dc1917f42
4 changed files with 19 additions and 1 deletions

View File

@@ -1662,7 +1662,7 @@ win_update(win_T *wp)
if (mod_top != 0
&& wp->w_topline == mod_top
&& (!wp->w_lines[0].wl_valid
|| wp->w_topline == wp->w_lines[0].wl_lnum))
|| wp->w_topline <= wp->w_lines[0].wl_lnum))
{
// w_topline is the first changed line and window is not scrolled,
// the scrolling from changed lines will be done further down.

View File

@@ -0,0 +1,4 @@
> +0&#ffffff0@19
|a@19
@1| @18
|~+0#4040ff13&| @18

View File

@@ -245,4 +245,16 @@ func Test_visual_block_scroll()
call delete(filename)
endfunc
func Test_display_scroll_at_topline()
CheckScreendump
let buf = RunVimInTerminal('', #{cols: 20})
call term_sendkeys(buf, ":call setline(1, repeat('a', 21))\<CR>")
call term_wait(buf)
call term_sendkeys(buf, "O\<Esc>")
call VerifyScreenDump(buf, 'Test_display_scroll_at_topline', #{rows: 4})
call StopVimInTerminal(buf)
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1488,
/**/
1487,
/**/