1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-11 00:51:05 +02:00

31037: return to previous position with vi-goto-mark using `` or ''

This commit is contained in:
Oliver Kiddle 2013-02-09 21:27:47 +00:00
parent 08df75a8b1
commit d88a46b1a9
2 changed files with 18 additions and 5 deletions

View file

@ -1,3 +1,8 @@
2013-02-09 Oliver Kiddle <opk@zsh.org>
* 31037: Src/Zle/zle_move.c: return to previous position
with vi-goto-mark using `` or ''
2013-02-07 Peter Stephenson <p.w.stephenson@ntlworld.com> 2013-02-07 Peter Stephenson <p.w.stephenson@ntlworld.com>
* Wieland Hoffmann: 31030: Completion/X/Command/_mplayer: * Wieland Hoffmann: 31030: Completion/X/Command/_mplayer:
@ -504,5 +509,5 @@
***************************************************** *****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL * This is used by the shell to define $ZSH_PATCHLEVEL
* $Revision: 1.5798 $ * $Revision: 1.5799 $
***************************************************** *****************************************************

View file

@ -30,7 +30,7 @@
#include "zle.mdh" #include "zle.mdh"
#include "zle_move.pro" #include "zle_move.pro"
static int vimarkcs[26], vimarkline[26]; static int vimarkcs[27], vimarkline[27];
#ifdef MULTIBYTE_SUPPORT #ifdef MULTIBYTE_SUPPORT
/* /*
@ -825,11 +825,17 @@ int
vigotomark(UNUSED(char **args)) vigotomark(UNUSED(char **args))
{ {
ZLE_INT_T ch; ZLE_INT_T ch;
int oldcs = zlecs;
int oldline = histline;
ch = getfullchar(0); ch = getfullchar(0);
if (ch == ZWC('\'') || ch == ZWC('`'))
ch = 26;
else {
if (ch < ZWC('a') || ch > ZWC('z')) if (ch < ZWC('a') || ch > ZWC('z'))
return 1; return 1;
ch -= ZWC('a'); ch -= ZWC('a');
}
if (!vimarkline[ch]) if (!vimarkline[ch])
return 1; return 1;
if (curhist != vimarkline[ch] && !zle_goto_hist(vimarkline[ch], 0, 0)) { if (curhist != vimarkline[ch] && !zle_goto_hist(vimarkline[ch], 0, 0)) {
@ -837,6 +843,8 @@ vigotomark(UNUSED(char **args))
return 1; return 1;
} }
zlecs = vimarkcs[ch]; zlecs = vimarkcs[ch];
vimarkcs[26] = oldcs;
vimarkline[26] = histline;
if (zlecs > zlell) if (zlecs > zlell)
zlecs = zlell; zlecs = zlell;
return 0; return 0;