about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2013-09-25 18:42:59 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2013-09-25 18:42:59 +0100
commit0ed3c5ccd0caef397eae0cce9529cda65bf31be5 (patch)
treefa0830d1b613bcde9721c0e2e190d449f28b308a
parent60debf388f65849fc31b92982274cc984da74052 (diff)
downloadzsh-0ed3c5ccd0caef397eae0cce9529cda65bf31be5.tar.gz
zsh-0ed3c5ccd0caef397eae0cce9529cda65bf31be5.tar.xz
zsh-0ed3c5ccd0caef397eae0cce9529cda65bf31be5.zip
31765: If zle starts in viins mark as insertion.
This allows undo to work on everything entered.
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/zle_main.c7
2 files changed, 12 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 88dad0284..e7106e13f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-09-25  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 31765: Src/Zle/zle_main.c: on entry to editor, if starting in
+	vi insert mode mark this as the start of an insertion (duh).
+
 2013-09-23  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* 31764 (with correction of sense of a test): Src/glob.c,
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 756ff111a..5798e74b4 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))) {