comparison src/testdir/test_terminal.vim @ 13956:300aab3275c0 v8.0.1848

patch 8.0.1848: 'termwinscroll' does not work properly commit https://github.com/vim/vim/commit/4d6cd291cec668b991f2b43d76c6feab8b2e7d98 Author: Bram Moolenaar <Bram@vim.org> Date: Tue May 15 23:53:26 2018 +0200 patch 8.0.1848: 'termwinscroll' does not work properly Problem: 'termwinscroll' does not work properly. (Dominique Pelle) Solution: Subtract removed scrollback from the scrollback count. Add a test for 'termwinscroll'. (closes #2909)
author Christian Brabandt <cb@256bit.org>
date Wed, 16 May 2018 00:00:12 +0200
parents b94a9171ec7c
children e88e2a8de4c5
comparison
equal deleted inserted replaced
13955:842f6d962a49 13956:300aab3275c0
1505 call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))}) 1505 call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))})
1506 exe buf . 'bwipe' 1506 exe buf . 'bwipe'
1507 call delete('Xechoerrout.sh') 1507 call delete('Xechoerrout.sh')
1508 call delete(outfile) 1508 call delete(outfile)
1509 endfunc 1509 endfunc
1510
1511 func Test_terminwinscroll()
1512 if !has('unix')
1513 return
1514 endif
1515
1516 " Let the terminal output more than 'termwinscroll' lines, some at the start
1517 " will be dropped.
1518 exe 'set termwinscroll=' . &lines
1519 let buf = term_start('/bin/sh')
1520 for i in range(1, &lines)
1521 call feedkeys("echo " . i . "\<CR>", 'xt')
1522 call WaitForAssert({-> assert_match(string(i), term_getline(buf, term_getcursor(buf)[0] - 1))})
1523 endfor
1524 " Go to Terminal-Normal mode to update the buffer.
1525 call feedkeys("\<C-W>N", 'xt')
1526 call assert_inrange(&lines, &lines * 110 / 100 + winheight(0), line('$'))
1527
1528 " Every "echo nr" must only appear once
1529 let lines = getline(1, line('$'))
1530 for i in range(&lines - len(lines) / 2 + 2, &lines)
1531 let filtered = filter(copy(lines), {idx, val -> val =~ 'echo ' . i . '\>'})
1532 call assert_equal(1, len(filtered), 'for "echo ' . i . '"')
1533 endfor
1534
1535 exe buf . 'bwipe!'
1536 endfunc