about summary refs log tree commit diff
path: root/Src/Zle/zle_vi.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle/zle_vi.c')
-rw-r--r--Src/Zle/zle_vi.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c
index 79b8cb958..994b44fe3 100644
--- a/Src/Zle/zle_vi.c
+++ b/Src/Zle/zle_vi.c
@@ -79,8 +79,9 @@ static void
 startvichange(int im)
 {
     if (im != -1) {
-	insmode = im;
 	vichgflag = 1;
+	if (im > -1)
+	    insmode = im;
     }
     if (inrepeat && im != -2) {
 	zmod = lastmod;
@@ -92,7 +93,8 @@ startvichange(int im)
 	    free(vichgbuf);
 	vichgbuf = (char *)zalloc(vichgbufsz = 16);
 	if (im == -2) {
-	    vichgbuf[0] = 'a';
+	    vichgbuf[0] =
+		zlell ? (insmode ? (zlecs < zlell ? 'i' : 'a') : 'R') : 'o';
 	} else {
 	    vichgbuf[0] = lastchar;
 	}