From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Zsh workers <zsh-workers@zsh.org>
Subject: PATCH: save last position in vi-goto-mark
Date: Fri, 08 Feb 2013 23:27:18 +0100 [thread overview]
Message-ID: <22481.1360362438@quattro> (raw)
This actually backs out some of 28611 so perhaps this once worked in the
distant past. `` or '' should return to the previous position from before the
last jump. The rather pointless `' and '` will also do the same but they do in
vim too. I suspect that with the original implementation, LASTFULLCHAR was
returning ` or ' and avoiding this quirk but it now returns the character of
the recently set mark (hence the bug that 28611 fixed). The code for saving the
old position must have either got lost or was forgotten in the first place.
Oliver
diff --git a/Src/Zle/zle_move.c b/Src/Zle/zle_move.c
index 4653855..73c8e59 100644
--- a/Src/Zle/zle_move.c
+++ b/Src/Zle/zle_move.c
@@ -30,7 +30,7 @@
#include "zle.mdh"
#include "zle_move.pro"
-static int vimarkcs[26], vimarkline[26];
+static int vimarkcs[27], vimarkline[27];
#ifdef MULTIBYTE_SUPPORT
/*
@@ -834,11 +834,17 @@ int
vigotomark(UNUSED(char **args))
{
ZLE_INT_T ch;
+ int oldcs = zlecs;
+ int oldline = histline;
ch = getfullchar(0);
- if (ch < ZWC('a') || ch > ZWC('z'))
- return 1;
- ch -= ZWC('a');
+ if (ch == ZWC('\'') || ch == ZWC('`'))
+ ch = 26;
+ else {
+ if (ch < ZWC('a') || ch > ZWC('z'))
+ return 1;
+ ch -= ZWC('a');
+ }
if (!vimarkline[ch])
return 1;
if (curhist != vimarkline[ch] && !zle_goto_hist(vimarkline[ch], 0, 0)) {
@@ -846,6 +852,8 @@ vigotomark(UNUSED(char **args))
return 1;
}
zlecs = vimarkcs[ch];
+ vimarkcs[26] = oldcs;
+ vimarkline[26] = histline;
if (zlecs > zlell)
zlecs = zlell;
return 0;
next reply other threads:[~2013-02-08 22:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-08 22:27 Oliver Kiddle [this message]
2013-02-10 22:11 ` zle test cases (Re: PATCH: save last position in vi-goto-mark) Oliver Kiddle
2013-02-11 9:44 ` Peter Stephenson
2013-03-28 10:36 ` PATCH: save last position in vi-goto-mark Jun T.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=22481.1360362438@quattro \
--to=okiddle@yahoo.co.uk \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).