Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: edit-command-line: disable `monitor' option locally



I was just told, that suspending an editor while using
`edit-command-line' will cause the command line to be lost, yielding
this:

edit-command-line:zle:17: widgets can only be called when ZLE is active

Which makes sense.

I first thought to disable suspending by disabling the appropriate
shortcut via `stty'. But that doesn't work if the editor suspends anyway
when it sees a "C-z" byte (vim does).

So, in order to shield users from accidential dataloss, this patch
unsets the `monitor' option temporarily. That does the trick for me and
I don't think there is anything this would break.

If I'm missing something, yell.
---
 Functions/Zle/edit-command-line |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/Functions/Zle/edit-command-line b/Functions/Zle/edit-command-line
index 250cac6..efcc4b9 100644
--- a/Functions/Zle/edit-command-line
+++ b/Functions/Zle/edit-command-line
@@ -6,6 +6,8 @@
 # will give ksh-like behaviour for that key,
 # except that it will handle multi-line buffers properly.
 
+setopt local_options no_monitor
+
 local tmpfile=${TMPPREFIX:-/tmp/zsh}ecl$$
 
 print -R - "$PREBUFFER$BUFFER" >$tmpfile
-- 
1.7.4.1.140.g89781



Messages sorted by: Reverse Date, Date, Thread, Author