Hello, In the documentation for :jumplist, it is mentioned that
You can explicitly add a jump by setting the ' mark. This is true by pressing m' and m` in normal mode, but it does not work by calling the equivalent :call setpos("''", getpos('.')). I am unsure if this is intentional, but if not, this patch addresses this issue (*pos and curwin->w_cursor were compared by identity, not value). I could not find an appropriate test script to append, so I took the liberty of adding test99.in and test99.ok. Thank you, Sung Pae
From 88ed50df83930edfb45d97e058842764fc828c4c Mon Sep 17 00:00:00 2001 From: guns <s...@sungpae.com> Date: Fri, 12 Jul 2013 13:25:45 -0500 Subject: [PATCH] Make setpos("''", getpos('.')) also push the jump list. The documentation for :jumplist says: You can explicitly add a jump by setting the ' mark. This is true by setting m' (and m`), but previously did not work when calling the equivalent setpos("''", getpos('.')). We fix this by comparing *pos and curwin->w_cursor by value instead of identity in setmark_pos(). --- src/mark.c | 2 +- src/testdir/test99.in | 19 +++++++++++++++++++ src/testdir/test99.ok | 6 ++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/testdir/test99.in create mode 100644 src/testdir/test99.ok diff --git a/src/mark.c b/src/mark.c index f31f53b..7cf821e 100644 --- a/src/mark.c +++ b/src/mark.c @@ -68,7 +68,7 @@ setmark_pos(c, pos, fnum) if (c == '\'' || c == '`') { - if (pos == &curwin->w_cursor) + if (equalpos(*pos, curwin->w_cursor)) { setpcmark(); /* keep it even when the cursor doesn't move */ diff --git a/src/testdir/test99.in b/src/testdir/test99.in new file mode 100644 index 0000000..746b95f --- /dev/null +++ b/src/testdir/test99.in @@ -0,0 +1,19 @@ +Test explicit jump list appending. + +STARTTEST +:call append(line('$'), 'alpha beta gamma') +/beta +:normal! m'^ye +:call append(line('$'), @") +:execute "normal! \<C-O>ye\<C-I>" +:call append(line('$'), @") +/gamma +:call setpos("''", getpos('.')) +:normal! ^ye +:call append(line('$'), @") +:execute "normal! \<C-O>ye" +:call append(line('$'), @") +:/\%#=1^Results/,$wq! test.out +ENDTEST + +Results of test99: diff --git a/src/testdir/test99.ok b/src/testdir/test99.ok new file mode 100644 index 0000000..bfb1381 --- /dev/null +++ b/src/testdir/test99.ok @@ -0,0 +1,6 @@ +Results of test99: +alpha beta gamma +alpha +beta +alpha +gamma -- 1.8.3.2
pgpdiVvzIt1fX.pgp
Description: PGP signature