zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: save last position in vi-goto-mark
@ 2013-02-08 22:27 Oliver Kiddle
  2013-02-10 22:11 ` zle test cases (Re: PATCH: save last position in vi-goto-mark) Oliver Kiddle
  2013-03-28 10:36 ` PATCH: save last position in vi-goto-mark Jun T.
  0 siblings, 2 replies; 4+ messages in thread
From: Oliver Kiddle @ 2013-02-08 22:27 UTC (permalink / raw)
  To: Zsh workers

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;


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-03-28 11:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-08 22:27 PATCH: save last position in vi-goto-mark Oliver Kiddle
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.

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).