about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/zle_main.c2
-rw-r--r--Src/Zle/zle_vi.c19
2 files changed, 14 insertions, 7 deletions
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 440f0cf8a..713221d0d 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1051,7 +1051,7 @@ zlecore(void)
 	    /* for vi mode, make sure the cursor isn't somewhere illegal */
 	    if (invicmdmode() && zlecs > findbol() &&
 		(zlecs == zlell || zleline[zlecs] == ZWC('\n')))
-		zlecs--;
+		DECCS();
 	    if (undoing)
 		handleundo();
 	} else {
diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c
index c807da359..b8c3936d4 100644
--- a/Src/Zle/zle_vi.c
+++ b/Src/Zle/zle_vi.c
@@ -353,10 +353,14 @@ videletechar(char **args)
 	return 1;
     /* Put argument into the acceptable range -- it is not an error to  *
      * specify a greater count than the number of available characters. */
-    if (n > findeol() - zlecs)
+    /* HERE: we should do the test properly with INCPOS(). */
+    if (n > findeol() - zlecs) {
 	n = findeol() - zlecs;
-    /* do the deletion */
-    forekill(n, CUT_RAW);
+	/* do the deletion */
+	forekill(n, CUT_RAW);
+    } else {
+	forekill(n, 0);
+    }
     return 0;
 }
 
@@ -714,10 +718,13 @@ vibackwarddeletechar(char **args)
     }
     /* Put argument into the acceptable range -- it is not an error to  *
      * specify a greater count than the number of available characters. */
-    if (n > zlecs - findbol())
+    /* HERE: we should do the test properly with DECPOS(). */
+    if (n > zlecs - findbol()) {
 	n = zlecs - findbol();
-    /* do the deletion */
-    backkill(n, CUT_FRONT|CUT_RAW);
+	/* do the deletion */
+	backkill(n, CUT_FRONT|CUT_RAW);
+    } else
+	backkill(n, CUT_FRONT);
     return 0;
 }