about summary refs log tree commit diff
path: root/Src/Zle/zle_vi.c
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2016-11-03 09:08:33 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2016-11-03 09:13:03 -0700
commit060ff489155c1c35ffcabfcc0ee5647d8a606d75 (patch)
treeab7e52797bf702dd495a7653a9574146b50921c1 /Src/Zle/zle_vi.c
parent696444714e9670f1f725381abde2cd8cb20d59dd (diff)
downloadzsh-060ff489155c1c35ffcabfcc0ee5647d8a606d75.tar.gz
zsh-060ff489155c1c35ffcabfcc0ee5647d8a606d75.tar.xz
zsh-060ff489155c1c35ffcabfcc0ee5647d8a606d75.zip
39820: vi-repeat handles multi-key bindings
Diffstat (limited to 'Src/Zle/zle_vi.c')
-rw-r--r--Src/Zle/zle_vi.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c
index 1e0402dff..e1cd758f7 100644
--- a/Src/Zle/zle_vi.c
+++ b/Src/Zle/zle_vi.c
@@ -71,7 +71,7 @@ static int inrepeat, vichgrepeat;
  * im: >= 0: is an insertmode
  *    -1: skip setting insert mode
  *    -2: entering viins at start of editing from clean --- don't use
- *        inrepeat or lastchar, synthesise an i to enter insert mode.
+ *        inrepeat or keybuf, synthesise an entry to insert mode.
  */
 
 /**/
@@ -91,14 +91,16 @@ startvichange(int im)
 	lastmod = zmod;
 	if (vichgbuf)
 	    free(vichgbuf);
-	vichgbuf = (char *)zalloc(vichgbufsz = 16);
+	vichgbuf = (char *)zalloc(vichgbufsz = 16 + keybuflen);
 	if (im == -2) {
 	    vichgbuf[0] =
 		zlell ? (insmode ? (zlecs < zlell ? 'i' : 'a') : 'R') : 'o';
+	    vichgbuf[1] = '\0';
+	    vichgbufptr = 1;
 	} else {
-	    vichgbuf[0] = lastchar;
+	    strcpy(vichgbuf, keybuf);
+	    unmetafy(vichgbuf, &vichgbufptr);
 	}
-	vichgbufptr = 1;
 	vichgrepeat = 0;
     }
 }