summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-11-20 12:11:45 +0000
committerBram Moolenaar <Bram@vim.org>2022-11-20 12:11:45 +0000
commit29967732761d1ffb5592db5f5aa7036f5b52abf1 (patch)
tree8ce74785996d6a469d1ab29c7d0f995210f75885 /src/testdir
parent228e422855d43965f2c3319ff0cdc26ea422c10f (diff)
downloadvim-git-29967732761d1ffb5592db5f5aa7036f5b52abf1.tar.gz
patch 9.0.0915: WinScrolled may trigger immediately when definedv9.0.0915
Problem: WinScrolled may trigger immediately when defined. Solution: Initialize the fields in all windows. (closes #11582)
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/dumps/Test_winscrolled_not_when_defined_1.dump10
-rw-r--r--src/testdir/dumps/Test_winscrolled_not_when_defined_2.dump10
-rw-r--r--src/testdir/test_autocmd.vim26
3 files changed, 46 insertions, 0 deletions
diff --git a/src/testdir/dumps/Test_winscrolled_not_when_defined_1.dump b/src/testdir/dumps/Test_winscrolled_not_when_defined_1.dump
new file mode 100644
index 000000000..ef42464cd
--- /dev/null
+++ b/src/testdir/dumps/Test_winscrolled_not_when_defined_1.dump
@@ -0,0 +1,10 @@
+>a+0&#ffffff0@2| @56
+|b@2| @56
+|~+0#4040ff13&| @58
+|~| @58
+|[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @28|1|,|1| @11|A|l@1
+|a+0&&@2| @56
+|b@2| @56
+|~+0#4040ff13&| @58
+|[+1#0000000&|N|o| |N|a|m|e|]| |[|+|]| @28|1|,|1| @11|A|l@1
+|:+0&&|a|u| |W|i|n|S|c|r|o|l@1|e|d| |*| |c|a|l@1| |t|i|m|e|r|_|s|t|a|r|t|(|1|0@1|,| |'|S|h|o|w|T|r|i|g@1|e|r|e|d|'|)| @3
diff --git a/src/testdir/dumps/Test_winscrolled_not_when_defined_2.dump b/src/testdir/dumps/Test_winscrolled_not_when_defined_2.dump
new file mode 100644
index 000000000..b5cbca404
--- /dev/null
+++ b/src/testdir/dumps/Test_winscrolled_not_when_defined_2.dump
@@ -0,0 +1,10 @@
+>b+0&#ffffff0@2| @56
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @28|2|,|1| @11|B|o|t
+|a+0&&@2| @56
+|b@2| @56
+|~+0#4040ff13&| @58
+|[+1#0000000&|N|o| |N|a|m|e|]| |[|+|]| @28|1|,|1| @11|A|l@1
+|t+0&&|r|i|g@1|e|r|e|d| @50
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim
index 5d3e0acdb..bcd4c53d2 100644
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -439,6 +439,32 @@ func Test_WinScrolled_once_only()
call StopVimInTerminal(buf)
endfunc
+" Check that WinScrolled is not triggered immediately when defined and there
+" are split windows.
+func Test_WinScrolled_not_when_defined()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ call setline(1, ['aaa', 'bbb'])
+ echo 'nothing happened'
+ func ShowTriggered(id)
+ echo 'triggered'
+ endfunc
+ END
+ call writefile(lines, 'Xtest_winscrolled_not', 'D')
+ let buf = RunVimInTerminal('-S Xtest_winscrolled_not', #{rows: 10, cols: 60, statusoff: 2})
+ call term_sendkeys(buf, ":split\<CR>")
+ call TermWait(buf)
+ " use a timer to show the message after redrawing
+ call term_sendkeys(buf, ":au WinScrolled * call timer_start(100, 'ShowTriggered')\<CR>")
+ call VerifyScreenDump(buf, 'Test_winscrolled_not_when_defined_1', {})
+
+ call term_sendkeys(buf, "\<C-E>")
+ call VerifyScreenDump(buf, 'Test_winscrolled_not_when_defined_2', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
func Test_WinScrolled_long_wrapped()
CheckRunVimInTerminal