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:
parent
1cd8023570
commit
200accac63
15 changed files with 75 additions and 65 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue