summaryrefslogtreecommitdiff
path: root/src/testdir/test_terminal.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-05-15 23:53:26 +0200
committerBram Moolenaar <Bram@vim.org>2018-05-15 23:53:26 +0200
commit4d6cd291cec668b991f2b43d76c6feab8b2e7d98 (patch)
tree05dbe0827a3579f6ab49fa12aaaafbf0f15d888b /src/testdir/test_terminal.vim
parent825ccf4039a1be1a6f27a8c447c57faebaf2dc83 (diff)
downloadvim-git-4d6cd291cec668b991f2b43d76c6feab8b2e7d98.tar.gz
patch 8.0.1848: 'termwinscroll' does not work properlyv8.0.1848
Problem: 'termwinscroll' does not work properly. (Dominique Pelle) Solution: Subtract removed scrollback from the scrollback count. Add a test for 'termwinscroll'. (closes #2909)
Diffstat (limited to 'src/testdir/test_terminal.vim')
-rw-r--r--src/testdir/test_terminal.vim27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index e9b69533d..c4e49b730 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -1507,3 +1507,30 @@ func Test_terminal_out_err()
call delete('Xechoerrout.sh')
call delete(outfile)
endfunc
+
+func Test_terminwinscroll()
+ if !has('unix')
+ return
+ endif
+
+ " Let the terminal output more than 'termwinscroll' lines, some at the start
+ " will be dropped.
+ exe 'set termwinscroll=' . &lines
+ let buf = term_start('/bin/sh')
+ for i in range(1, &lines)
+ call feedkeys("echo " . i . "\<CR>", 'xt')
+ call WaitForAssert({-> assert_match(string(i), term_getline(buf, term_getcursor(buf)[0] - 1))})
+ endfor
+ " Go to Terminal-Normal mode to update the buffer.
+ call feedkeys("\<C-W>N", 'xt')
+ call assert_inrange(&lines, &lines * 110 / 100 + winheight(0), line('$'))
+
+ " Every "echo nr" must only appear once
+ let lines = getline(1, line('$'))
+ for i in range(&lines - len(lines) / 2 + 2, &lines)
+ let filtered = filter(copy(lines), {idx, val -> val =~ 'echo ' . i . '\>'})
+ call assert_equal(1, len(filtered), 'for "echo ' . i . '"')
+ endfor
+
+ exe buf . 'bwipe!'
+endfunc