summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-08-29 21:42:42 +0200
committerBram Moolenaar <Bram@vim.org>2018-08-29 21:42:42 +0200
commit92c1b696413bf0e28f2fec22090d42e8a825eff2 (patch)
tree7f2e3d6d9e4fab5a519487090789ee1b5f98e869 /src/testdir
parenta449a7c6b986b8f5b28c61b8f628e69ed43ca030 (diff)
downloadvim-git-92c1b696413bf0e28f2fec22090d42e8a825eff2.tar.gz
patch 8.1.0333: :mkview does not restore cursor properly after "$"v8.1.0333
Problem: :mkview does not restore cursor properly after "$". (Dominique Pelle) Solution: Position the cursor with "normal! $".
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_mksession.vim16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/testdir/test_mksession.vim b/src/testdir/test_mksession.vim
index c0b82ffa8..ed8b10fa0 100644
--- a/src/testdir/test_mksession.vim
+++ b/src/testdir/test_mksession.vim
@@ -22,7 +22,8 @@ func Test_mksession()
\ 'two tabs in one line',
\ 'one ä multibyteCharacter',
\ 'aä Ä two multiByte characters',
- \ 'Aäöü three mulTibyte characters'
+ \ 'Aäöü three mulTibyte characters',
+ \ 'short line',
\ ])
let tmpfile = 'Xtemp'
exec 'w! ' . tmpfile
@@ -44,6 +45,8 @@ func Test_mksession()
norm! j16|
split
norm! j16|
+ split
+ norm! j$
wincmd l
set nowrap
@@ -66,7 +69,7 @@ func Test_mksession()
split
call wincol()
mksession! Xtest_mks.out
- let li = filter(readfile('Xtest_mks.out'), 'v:val =~# "\\(^ *normal! 0\\|^ *exe ''normal!\\)"')
+ let li = filter(readfile('Xtest_mks.out'), 'v:val =~# "\\(^ *normal! [0$]\\|^ *exe ''normal!\\)"')
let expected = [
\ 'normal! 016|',
\ 'normal! 016|',
@@ -76,6 +79,7 @@ func Test_mksession()
\ 'normal! 016|',
\ 'normal! 016|',
\ 'normal! 016|',
+ \ 'normal! $',
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
\ " normal! 016|",
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
@@ -317,7 +321,7 @@ func Test_mkview_file()
help :mkview
set number
norm! V}zf
- let pos = getpos('.')
+ let pos = getcurpos()
let linefoldclosed1 = foldclosed('.')
mkview! Xview
set nonumber
@@ -329,7 +333,7 @@ func Test_mkview_file()
source Xview
call assert_equal(1, &number)
call assert_match('\*:mkview\*$', getline('.'))
- call assert_equal(pos, getpos('.'))
+ call assert_equal(pos, getcurpos())
call assert_equal(linefoldclosed1, foldclosed('.'))
" Creating a view again with the same file name should fail (file
@@ -352,7 +356,7 @@ func Test_mkview_loadview_with_viewdir()
help :mkview
set number
norm! V}zf
- let pos = getpos('.')
+ let pos = getcurpos()
let linefoldclosed1 = foldclosed('.')
mkview 1
set nonumber
@@ -369,7 +373,7 @@ func Test_mkview_loadview_with_viewdir()
\ glob('Xviewdir/*'))
call assert_equal(1, &number)
call assert_match('\*:mkview\*$', getline('.'))
- call assert_equal(pos, getpos('.'))
+ call assert_equal(pos, getcurpos())
call assert_equal(linefoldclosed1, foldclosed('.'))
call delete('Xviewdir', 'rf')