summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-01-20 18:25:54 +0100
committerBram Moolenaar <Bram@vim.org>2019-01-20 18:25:54 +0100
commit10772307c4e5299ed45470f92779f089a00d841e (patch)
tree9833e1deac8d97753cf44e919ebf48ec38e936d7 /src/testdir
parent113e10721f42fc2500b63fe95193f8665658a90c (diff)
downloadvim-git-10772307c4e5299ed45470f92779f089a00d841e.tar.gz
patch 8.1.0786: ml_get error when updating the status linev8.1.0786
Problem: ml_get error when updating the status line and a terminal had its scrollback cleared. (Chris Patuzzo) Solution: Check the cursor position when drawing the status line. (closes #3830)
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_terminal.vim25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index f78d66ca2..960a85e97 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -1719,3 +1719,28 @@ func Test_term_gettitle()
exe term . 'bwipe!'
endfunc
+
+" When drawing the statusline the cursor position may not have been updated
+" yet.
+" 1. create a terminal, make it show 2 lines
+" 2. 0.5 sec later: leave terminal window, execute "i"
+" 3. 0.5 sec later: clear terminal window, now it's 1 line
+" 4. 0.5 sec later: redraw, including statusline (used to trigger bug)
+" 4. 0.5 sec later: should be done, clean up
+func Test_terminal_statusline()
+ if !has('unix')
+ return
+ endif
+ set statusline=x
+ terminal
+ let tbuf = bufnr('')
+ call term_sendkeys(tbuf, "clear; echo a; echo b; sleep 1; clear\n")
+ call timer_start(500, { tid -> feedkeys("\<C-w>j", 'tx') })
+ call timer_start(1500, { tid -> feedkeys("\<C-l>", 'tx') })
+ au BufLeave * if &buftype == 'terminal' | silent! normal i | endif
+
+ sleep 2
+ exe tbuf . 'bwipe!'
+ au! BufLeave
+ set statusline=
+endfunc