summary refs log tree commit diff
path: root/Functions/Zle/read-from-minibuffer
diff options
context:
space:
mode:
Diffstat (limited to 'Functions/Zle/read-from-minibuffer')
-rw-r--r--Functions/Zle/read-from-minibuffer20
1 files changed, 20 insertions, 0 deletions
diff --git a/Functions/Zle/read-from-minibuffer b/Functions/Zle/read-from-minibuffer
new file mode 100644
index 000000000..93eec42a5
--- /dev/null
+++ b/Functions/Zle/read-from-minibuffer
@@ -0,0 +1,20 @@
+local savelbuffer=$LBUFFER saverbuffer=$RBUFFER
+local savepredisplay=$PREDISPLAY savepostdisplay=$POSTDISPLAY
+
+LBUFFER=
+RBUFFER=
+PREDISPLAY="$PREDISPLAY$savelbuffer$saverbuffer$POSTDISPLAY
+${1:-? }"
+POSTDISPLAY=
+
+zle recursive-edit
+integer stat=$?
+
+(( stat )) || REPLY=$BUFFER
+
+LBUFFER=$savelbuffer
+RBUFFER=$saverbuffer
+PREDISPLAY=$savepredisplay
+POSTDISPLAY=$savepostdisplay
+
+return $stat