summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/zle.h1
-rw-r--r--Src/Zle/zle_utils.c2
-rw-r--r--Src/Zle/zle_vi.c24
3 files changed, 20 insertions, 7 deletions
diff --git a/Src/Zle/zle.h b/Src/Zle/zle.h
index 860c8217c..dd6cdcca0 100644
--- a/Src/Zle/zle.h
+++ b/Src/Zle/zle.h
@@ -240,6 +240,7 @@ struct modifier {
 #define MOD_VIBUF (1<<2)   /* a vi cut buffer has been selected */
 #define MOD_VIAPP (1<<3)   /* appending to the vi cut buffer */
 #define MOD_NEG   (1<<4)   /* last command was negate argument */
+#define MOD_NULL  (1<<5)   /* throw away text for the vi cut buffer */
 
 /* current modifier status */
 
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index f69bc77c9..46d5373fb 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -914,7 +914,7 @@ cut(int i, int ct, int flags)
 void
 cuttext(ZLE_STRING_T line, int ct, int flags)
 {
-    if (!ct)
+    if (!ct || zmod.flags & MOD_NULL)
 	return;
 
     UNMETACHECK();
diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c
index 2555c6a00..20cece0a8 100644
--- a/Src/Zle/zle_vi.c
+++ b/Src/Zle/zle_vi.c
@@ -782,7 +782,7 @@ viputbefore(UNUSED(char **args))
     int n = zmult;
 
     startvichange(-1);
-    if (n < 0)
+    if (n < 0 || zmod.flags & MOD_NULL)
 	return 1;
     if (zmod.flags & MOD_VIBUF)
 	buf = &vibuf[zmod.vibuf];
@@ -814,7 +814,7 @@ viputafter(UNUSED(char **args))
     int n = zmult;
 
     startvichange(-1);
-    if (n < 0)
+    if (n < 0 || zmod.flags & MOD_NULL)
 	return 1;
     if (zmod.flags & MOD_VIBUF)
 	buf = &vibuf[zmod.vibuf];
@@ -905,14 +905,26 @@ vicapslockpanic(UNUSED(char **args))
 
 /**/
 int
-visetbuffer(UNUSED(char **args))
+visetbuffer(char **args)
 {
     ZLE_INT_T ch;
 
-    if ((zmod.flags & MOD_VIBUF) ||
-	(((ch = getfullchar(0)) < ZWC('0') || ch > ZWC('9')) &&
+    if (*args) {
+	ch = **args;
+	if (args[1] || (ch && (*args)[1]))
+	    return 1;
+    } else {
+	ch = getfullchar(0);
+    }
+    if (ch == ZWC('_')) {
+	zmod.flags |= MOD_NULL;
+	prefixflag = 1;
+	return 0;
+    } else
+	zmod.flags &= ~MOD_NULL;
+    if ((ch < ZWC('0') || ch > ZWC('9')) &&
 	 (ch < ZWC('a') || ch > ZWC('z')) &&
-	 (ch < ZWC('A') || ch > ZWC('Z'))))
+	 (ch < ZWC('A') || ch > ZWC('Z')))
 	return 1;
     if (ch >= ZWC('A') && ch <= ZWC('Z'))	/* needed in cut() */
 	zmod.flags |= MOD_VIAPP;