patch 8.2.3763: when editing the cmdline a callback may cause a scroll up
Problem: When editing the command line a FocusLost callback may cause the
screen to scroll up.
Solution: Do not redraw at the last line but at the same place where the
command line was before. (closes #9295)
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 61b1458..3efc6bb 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -1135,8 +1135,8 @@
let lines =<< trim END
set term=xterm ttymouse=xterm2
- au FocusLost * echo 'I am lost'
- au FocusGained * echo 'I am back'
+ au FocusLost * call setline(1, 'I am lost') | set nomod
+ au FocusGained * call setline(1, 'I am back') | set nomod
" FIXME: sometimes this job hangs, exit after a couple of seconds
call timer_start(2000, {id -> execute('qall')})
END
@@ -1152,6 +1152,14 @@
call TermWait(buf)
call VerifyScreenDump(buf, 'Test_terminal_focus_2', {})
+ " check that a command line being edited is redrawn in place
+ call term_sendkeys(buf, ":" .. repeat('x', 80))
+ call TermWait(buf)
+ call feedkeys("\<Esc>[O", "Lx!")
+ call TermWait(buf)
+ call VerifyScreenDump(buf, 'Test_terminal_focus_3', {})
+ call term_sendkeys(buf, "\<Esc>")
+
call StopVimInTerminal(buf)
call delete('XtermFocus')
let &term = save_term