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

Re: counterintuitive behavior of zle_bracketed_paste



On Jun 11, 12:37pm, Peter Backes wrote:
}
} While backeted paste mode is certainly a good thing, this behavior is 
} very counterintuitive.  If the last pasted character is a return, the 
} command should instead be executed instantly.

Thanks for your input, but we had quite a long discussion about this on
the mailing list and the consensus was for the current behavior.

IIRC the case that brought us to this conclusion was what happens when
the paste is in the middle of the edit buffer rather than at a fresh
prompt or at the end of the buffer; i.e., when $RBUFFER is not empty.
The contents of the existing buffer as well as the presence of newlines
in the pasted text, matters, and it is better to have one consistent
paste behavior that does the least surprising thing in all cases.

As Daniel has already mentioned, there are ways to customize around
this if you strongly feel that a different behavior is better for you.
In addition to his suggested function, the bracketed-paste-magic widget
provides several hooks for modifying bracketed-paste behavior.

E.g.:

    autoload bracketed-paste-magic
    zle -N bracketed-paste bracketed-paste-magic

    bp-run-immediate () {
	[[ "$PASTED" = *$'\n' ]] && zle -U $'\n'
    }
    zstyle :bracketed-paste-magic paste-finish bp-run-immediate



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