diff options
author | Barton E. Schaefer <schaefer@zsh.org> | 2016-12-24 00:15:21 -0800 |
---|---|---|
committer | Barton E. Schaefer <schaefer@zsh.org> | 2016-12-24 00:15:21 -0800 |
commit | 5455798bb52dd983836318be36ac67e698457d10 (patch) | |
tree | 7d4b2348fe145bc0e1de2477786fd5f258b7ba74 | |
parent | 02eb1595e8687fd0facd4a8b0e4a19c61a35b664 (diff) | |
download | zsh-5455798bb52dd983836318be36ac67e698457d10.tar.gz zsh-5455798bb52dd983836318be36ac67e698457d10.tar.xz zsh-5455798bb52dd983836318be36ac67e698457d10.zip |
Oliver: 40118: alternate fix replacing 40115
This commit reverts 40115 (commit 3594f55f) thus restoring 38579, then applies 40118: Relocate BUFFER/CURSOR reset to work around "fc -p" issue
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | Functions/Zle/bracketed-paste-magic | 44 |
2 files changed, 28 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog index 8e07e45fa..7fbff294a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2016-12-24 Barton E. Schaefer <schaefer@zsh.org> + + * Oliver: 40118: Functions/Zle/bracketed-paste-magic: relocate + BUFFER/CURSOR reset to work around "fc -p" issue (alternate fix + replacing 40115). + + * unposted: Functions/Zle/bracketed-paste-magic: revert 40115, + thus restoring 38579. + 2016-12-22 Oliver Kiddle <opk@zsh.org> * 40162: Src/Zle/computil.c, Test/Y03arguments.ztst: _arguments diff --git a/Functions/Zle/bracketed-paste-magic b/Functions/Zle/bracketed-paste-magic index c46f741d5..4baae823e 100644 --- a/Functions/Zle/bracketed-paste-magic +++ b/Functions/Zle/bracketed-paste-magic @@ -145,27 +145,26 @@ bracketed-paste-magic() { done fi - # Save context, create a clean slate for the paste - integer bpm_mark=$MARK bpm_cursor=$CURSOR bpm_region=$REGION_ACTIVE - integer bpm_numeric=${NUMERIC:-1} - local bpm_buffer=$BUFFER - fc -p -a /dev/null 0 0 - BUFFER= - zstyle -a :bracketed-paste-magic inactive-keys bpm_inactive if zstyle -s :bracketed-paste-magic active-widgets bpm_active '|'; then - # There are active widgets. Reprocess $PASTED as keystrokes. - NUMERIC=1 - zle -U - $PASTED - + # Save context, create a clean slate for the paste + integer bpm_mark=$MARK bpm_region=$REGION_ACTIVE + integer bpm_numeric=${NUMERIC:-1} + integer bpm_limit=$UNDO_LIMIT_NO bpm_undo=$UNDO_CHANGE_NO + zle .split-undo + UNDO_LIMIT_NO=$UNDO_CHANGE_NO + BUFFER= + CURSOR=1 + fc -p -a /dev/null 0 0 if [[ $bmp_keymap = vicmd ]]; then zle -K viins fi + # There are active widgets. Reprocess $PASTED as keystrokes. + NUMERIC=1 + zle -U - $PASTED + # Just in case there are active undo widgets - zle .split-undo - integer bpm_limit=$UNDO_LIMIT_NO bpm_undo=$UNDO_CHANGE_NO - UNDO_LIMIT_NO=$UNDO_CHANGE_NO while [[ -n $PASTED ]] && zle .read-command; do PASTED=${PASTED#$KEYS} @@ -183,21 +182,16 @@ bracketed-paste-magic() { done PASTED=$BUFFER - # Reset the undo state + # Restore state + zle -K $bpm_keymap + fc -P + MARK=$bpm_mark + REGION_ACTIVE=$bpm_region + NUMERIC=$bpm_numeric zle .undo $bpm_undo UNDO_LIMIT_NO=$bpm_limit - - zle -K $bpm_keymap fi - # Restore state - BUFFER=$bpm_buffer - MARK=$bpm_mark - CURSOR=$bpm_cursor - REGION_ACTIVE=$bpm_region - NUMERIC=$bpm_numeric - fc -P - # PASTED has been updated, run the paste-finish functions if zstyle -a :bracketed-paste-magic paste-finish bpm_hooks; then for bpm_func in $bpm_hooks; do |