On Wed, Sep 05, 2012 at 10:22:34AM -0700, ZyX wrote: > It works from inside expression mappings, like > nnoremap <expr> GG ":echom ".screenrow()." ".screencol()."\n" > . I believe it is fine and correct behavior: always reporting > real cursor position. Not very convenient, but correct, and > completely enough for tests. Just mention this workaround in > the doc.
Hello ZyX,
Thanks for the hint. Attached is a testcase which ports my old
tests to use your suggestion.
I noticed that screencol()/screenrow() start from zero while the
other *col() functions start from one. Should I update my
screencol()/screenrow() patch?
Regards,
Simon
---
src/testdir/Makefile | 4 +-
src/testdir/test88.in | 84 +++++++++++++++++++++++++++++++++++++++++++++++++
src/testdir/test88.ok | 23 +++++++++++++
3 files changed, 109 insertions(+), 2 deletions(-)
create mode 100644 src/testdir/test88.in
create mode 100644 src/testdir/test88.ok
diff --git a/src/testdir/Makefile b/src/testdir/Makefile
index 20d9781..936bca9 100644
--- a/src/testdir/Makefile
+++ b/src/testdir/Makefile
@@ -13,7 +13,7 @@ VIMPROG = ../vim
SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
test7.out test8.out test9.out test10.out test11.out \
- test12.out test13.out test14.out test15.out test17.out \
+ test12.out test13.out test14.out test15.out test17.out \
test18.out test19.out test20.out test21.out test22.out \
test23.out test24.out test25.out test26.out test27.out \
test28.out test29.out test30.out test31.out test32.out \
@@ -27,7 +27,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out
test6.out \
test69.out test70.out test71.out test72.out test73.out \
test74.out test75.out test76.out test77.out test78.out \
test79.out test80.out test81.out test82.out test83.out \
- test84.out test85.out test86.out test87.out
+ test84.out test85.out test86.out test87.out test88.out \
SCRIPTS_GUI = test16.out
diff --git a/src/testdir/test88.in b/src/testdir/test88.in
new file mode 100644
index 0000000..26b9a1d
--- /dev/null
+++ b/src/testdir/test88.in
@@ -0,0 +1,84 @@
+vim: set ft=vim
+
+Tests for correct display (cursor column position) with +conceal and
+tabulators.
+
+STARTTEST
+:so small.vim
+:if !has('conceal')
+ e! test.ok
+ wq! test.out
+:endif
+:" Conceal settings.
+:set conceallevel=2
+:set concealcursor=nc
+:syntax match test /|/ conceal
+:" Save current cursor position. Only works in <expr> mode, can't be used
+:" with :normal because it moves the cursor to the command line.
+:let positions = []
+:nnoremap <expr> GG ":let positions += ['".screenrow().":".screencol()."']\n"
+:" Start test.
+/^start:
+:normal ztj
+GGk
+:" We should end up in the same column when running these commands on the two
+:" lines.
+:normal ft
+GGk
+:normal $
+GGk
+:normal 0j
+GGk
+:normal ft
+GGk
+:normal $
+GGk
+:normal 0j0j
+GGk
+:" Same for next test block.
+:normal ft
+GGk
+:normal $
+GGk
+:normal 0j
+GGk
+:normal ft
+GGk
+:normal $
+GGk
+:normal 0j0j
+GGk
+:" And check W with multiple tabs and conceals in a line.
+:normal W
+GGk
+:normal W
+GGk
+:normal W
+GGk
+:normal $
+GGk
+:normal 0j
+GGk
+:normal W
+GGk
+:normal W
+GGk
+:normal W
+GGk
+:normal $
+GGk
+:" Display result.
+:call append('$', 'end:')
+:call append('$', positions)
+:/^end/,$wq! test.out
+ENDTEST
+
+start:
+.concealed. text
+|concealed| text
+
+ .concealed. text
+ |concealed| text
+
+.a. .b. .c. .d.
+|a| |b| |c| |d|
diff --git a/src/testdir/test88.ok b/src/testdir/test88.ok
new file mode 100644
index 0000000..b9f798e
--- /dev/null
+++ b/src/testdir/test88.ok
@@ -0,0 +1,23 @@
+end:
+1:0
+1:16
+1:19
+2:0
+2:16
+2:19
+4:7
+4:24
+4:27
+5:7
+5:24
+5:27
+7:0
+7:8
+7:16
+7:24
+7:26
+8:0
+8:8
+8:16
+8:24
+8:25
--
1.7.7.3
--
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9
pgpekJNOwffhU.pgp
Description: PGP signature
