vim-patch:8.1.1757: text added with appendbufline() isn't displayed

Problem:    Text added with appendbufline() to another buffer isn't displayed.
Solution:   Update topline. (partly by Christian Brabandt, closes vim/vim#4718)
2984666291
This commit is contained in:
Jan Edmund Lazo 2019-08-24 14:02:51 -04:00
parent 34e4166673
commit 4fedef51b0
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15
2 changed files with 27 additions and 0 deletions

View File

@ -15194,6 +15194,7 @@ static void set_buffer_lines(buf_T *buf, linenr_T lnum_arg, bool append,
} }
} }
check_cursor_col(); check_cursor_col();
update_topline();
} }
if (!is_curbuf) { if (!is_curbuf) {

View File

@ -1,6 +1,7 @@
" Tests for setbufline(), getbufline(), appendbufline(), deletebufline() " Tests for setbufline(), getbufline(), appendbufline(), deletebufline()
source shared.vim source shared.vim
" source screendump.vim
func Test_setbufline_getbufline() func Test_setbufline_getbufline()
new new
@ -112,3 +113,28 @@ func Test_deletebufline()
call assert_equal(['b', 'c'], getbufline(b, 1, 2)) call assert_equal(['b', 'c'], getbufline(b, 1, 2))
exe "bwipe! " . b exe "bwipe! " . b
endfunc endfunc
func Test_appendbufline_redraw()
if !CanRunVimInTerminal()
throw 'Skipped: cannot make screendumps'
endif
let lines =<< trim END
new foo
let winnr=bufwinnr('foo')
let buf=bufnr('foo')
wincmd p
call appendbufline(buf, '$', range(1,200))
exe winnr. 'wincmd w'
norm! G
wincmd p
call deletebufline(buf, 1, '$')
call appendbufline(buf, '$', 'Hello Vim world...')
END
call writefile(lines, 'XscriptMatchCommon')
let buf = RunVimInTerminal('-S XscriptMatchCommon', #{rows: 10})
call term_wait(buf)
call VerifyScreenDump(buf, 'Test_appendbufline_1', {})
call StopVimInTerminal(buf)
call delete('XscriptMatchCommon')
endfunc