diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | Src/Zle/zle_move.c | 36 |
2 files changed, 26 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog index fd9c87edc..4553d2c23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2015-08-11 Oliver Kiddle <opk@zsh.org> + * 36096: Src/Zle/zle_move.c: special . mark in vi mode + * 36044: Doc/Zsh/zle.yo, Src/Zle/iwidgets.list, Src/Zle/zle_keymap.c, Src/Zle/zle_move.c: deactivate-region widget for escape in visual mode diff --git a/Src/Zle/zle_move.c b/Src/Zle/zle_move.c index cf8f34595..f49df8647 100644 --- a/Src/Zle/zle_move.c +++ b/Src/Zle/zle_move.c @@ -883,24 +883,36 @@ int vigotomark(UNUSED(char **args)) { ZLE_INT_T ch; + int *markcs, *markhist = 0; int oldcs = zlecs; int oldline = histline; + int tmpcs, tmphist; ch = getfullchar(0); - 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)) { - vimarkline[ch] = 0; + if (ch == ZWC('\'') || ch == ZWC('`')) { + markhist = vimarkline + 26; + markcs = vimarkcs + 26; + } else if (ch == ZWC('.') && curchange->prev) { + /* position cursor where it was after the last change. not exactly + * what vim does but close enough */ + tmpcs = curchange->prev->new_cs; + tmphist = curchange->prev->hist; + markcs = &tmpcs; + markhist = &tmphist; + } else if (ch >= ZWC('a') && ch <= ZWC('z')) { + markhist = vimarkline + (ch - ZWC('a')); + markcs = vimarkcs + (ch - ZWC('a')); + } else return 1; + if (markhist) { + if (!*markhist) + return 1; + if (histline != *markhist && !zle_goto_hist(*markhist, 0, 0)) { + *markhist = 0; + return 1; + } } - zlecs = vimarkcs[ch]; + zlecs = *markcs; vimarkcs[26] = oldcs; vimarkline[26] = oldline; if (zlecs > zlell) |