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

Re: problem with push-line-or-edit and precmd?



On Jan 16,  5:21pm, Greg Klanderman wrote:
}
} Notice the precmd is run when the push-line-or-edit widget is invoked,
} and that $? is set to 1 in the precmd.
} 
} Is it expected that precmd would be run here?
} 
} And if so, why is a non-zero exit status set?

This is an admitted misfeature of the push-line-or-edit implementation,
which in order to accomplish its purpose of invoking the editor on the
multi-line buffer as a single editable region, does almost exactly the
equivalent of

	print -z "$BUFFER"
	zle send-break

This causes the current zle "session" to abort, which returns from the
PS2 or deeper prompt all the way to the top level, at which point the
editor re-initializes at the PS1 prompt and pops the buffer stack and
you're back where you want to be.

The side-effects of this include that a zle widget can't do anything
after push-line-or-edit (the widget forcibly exits), the status is
set to nonzero, and precmd runs because the editor has restarted, all
as if the user hit ctrl+c.

This is one case where a change would be welcome, if a better way could
be found to trash the entire nested editor context up from whatever
prompt level you're reached, and thereby reset at PS1.



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