about summary refs log tree commit diff
path: root/Src/Zle/zle_misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle/zle_misc.c')
-rw-r--r--Src/Zle/zle_misc.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index fef55f01d..e24d0c08b 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -57,7 +57,7 @@ doinsert(char *str)
 }
 
 /**/
-int
+mod_export int
 selfinsert(char **args)
 {
     char s[3], *p = s;
@@ -542,6 +542,32 @@ copyprevword(char **args)
 
 /**/
 int
+copyprevshellword(char **args)
+{
+    LinkList l;
+    LinkNode n;
+    int i;
+    char *p = NULL;
+
+    if ((l = bufferwords(NULL, NULL, &i)))
+        for (n = firstnode(l); n; incnode(n))
+            if (!i--) {
+                p = getdata(n);
+                break;
+            }
+
+    if (p) {
+	int len = strlen(p);
+
+	spaceinline(len);
+	memcpy(line + cs, p, len);
+	cs += len;
+    }
+    return 0;
+}
+
+/**/
+int
 sendbreak(char **args)
 {
     errflag = 1;