1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-11-12 10:00:56 +01:00

34067: safe tempfile creation, part 1

This commit is contained in:
Barton E. Schaefer 2014-12-27 23:59:29 -08:00
parent 1cd8023570
commit 200accac63
15 changed files with 75 additions and 65 deletions

View file

@ -6,12 +6,10 @@
# will give ksh-like behaviour for that key,
# except that it will handle multi-line buffers properly.
local tmpfile=${TMPPREFIX:-/tmp/zsh}ecl$$
() {
exec </dev/tty
${=${VISUAL:-${EDITOR:-vi}}} $1
print -Rz - "$(<$1)"
} =(<<<"$PREBUFFER$BUFFER")
print -R - "$PREBUFFER$BUFFER" >$tmpfile
exec </dev/tty
${=${VISUAL:-${EDITOR:-vi}}} $tmpfile
print -Rz - "$(<$tmpfile)"
command rm -f $tmpfile
zle send-break # Force reload from the buffer stack