Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zle: vi mode: wrong undo handling on fresh lines
- X-seq: zsh-workers 31765
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: zle: vi mode: wrong undo handling on fresh lines
- Date: Mon, 23 Sep 2013 21:30:14 +0100
- In-reply-to: <CANWLQWsV5i+=3NptAxir6UYCoipFa2Pk+g6D1DDnMnJMVCbDgA@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CANWLQWsV5i+=3NptAxir6UYCoipFa2Pk+g6D1DDnMnJMVCbDgA@mail.gmail.com>
On Sun, 22 Sep 2013 14:37:25 +0200
Hauke Petersen <hkptrsn@xxxxxxxxx> wrote:
> Insert operations should count as a single step in the undo history,
> i.e. from command mode
>
> ifoo<ESC>u
>
> should effectively be a no-op.
>
> AFAICT, zsh handles this fine with the exception of fresh lines.
Is it something like this, perhaps?
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 756ff11..5798e74 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1188,6 +1188,13 @@ zleread(char **lp, char **rp, int flags, int context, char *init, char *finish)
viinsbegin = 0;
statusline = NULL;
selectkeymap("main", 1);
+ /*
+ * If main is linked to the viins keymap, we need to register
+ * explicitly that we're now in vi insert mode as there's
+ * no user operation to indicate this.
+ */
+ if (openkeymap("main") == openkeymap("viins"))
+ viinsert(NULL);
selectlocalmap(NULL);
fixsuffix();
if ((s = getlinknode(bufstack))) {
--
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author