Mercurial > vim
diff src/testdir/test_normal.vim @ 18475:709c6b0dc78f v8.1.2231
patch 8.1.2231: not easy to move to the middle of a text line
Commit: https://github.com/vim/vim/commit/8b530c1ff91f07cf6b0289a536992b7dfbc86598
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Oct 28 02:13:05 2019 +0100
patch 8.1.2231: not easy to move to the middle of a text line
Problem: Not easy to move to the middle of a text line.
Solution: Add the gM command. (Yasuhiro Matsumoto, closes https://github.com/vim/vim/issues/2070)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 28 Oct 2019 02:15:05 +0100 |
parents | 0eeaa9a6e4e7 |
children | 2faf6c331cb8 |
line wrap: on
line diff
--- a/src/testdir/test_normal.vim +++ b/src/testdir/test_normal.vim @@ -1733,6 +1733,7 @@ fun! Test_normal33_g_cmd2() set wrap listchars= sbr= let lineA='abcdefghijklmnopqrstuvwxyz' let lineB='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' + let lineC='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' $put =lineA $put =lineB @@ -1766,9 +1767,30 @@ fun! Test_normal33_g_cmd2() call assert_equal(15, col('.')) call assert_equal('l', getreg(0)) + norm! 2ggdd + $put =lineC + + " Test for gM + norm! gMyl + call assert_equal(73, col('.')) + call assert_equal('0', getreg(0)) + " Test for 20gM + norm! 20gMyl + call assert_equal(29, col('.')) + call assert_equal('S', getreg(0)) + " Test for 60gM + norm! 60gMyl + call assert_equal(87, col('.')) + call assert_equal('E', getreg(0)) + + " Test for g Ctrl-G + set ff=unix + let a=execute(":norm! g\<c-g>") + call assert_match('Col 87 of 144; Line 2 of 2; Word 1 of 1; Byte 88 of 146', a) + " Test for gI norm! gIfoo - call assert_equal(['', 'fooabcdefghijk lmno0123456789AMNOPQRSTUVWXYZ'], getline(1,'$')) + call assert_equal(['', 'foo0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'], getline(1,'$')) " Test for gi wincmd c