From e54578ff74754b70e230106d292eb645f61176f1 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sun, 14 Feb 2016 11:35:18 -0800 Subject: 37971: fix potential issues when interacting with user-defined widgets Cf. users/21284: Eric Freese --- Functions/Zle/bracketed-paste-magic | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Functions/Zle/bracketed-paste-magic') diff --git a/Functions/Zle/bracketed-paste-magic b/Functions/Zle/bracketed-paste-magic index 2b2bc630d..498cf554d 100644 --- a/Functions/Zle/bracketed-paste-magic +++ b/Functions/Zle/bracketed-paste-magic @@ -175,7 +175,7 @@ bracketed-paste-magic() { case $REPLY in (${~bpm_active}) function () { emulate -L $bpm_emulate; set -$bpm_opts - zle $REPLY + zle $REPLY -w };; (*) zle .self-insert;; esac @@ -184,7 +184,7 @@ bracketed-paste-magic() { PASTED=$BUFFER # Reset the undo state - zle undo $bpm_undo + zle .undo $bpm_undo UNDO_LIMIT_NO=$bpm_limit zle -K $bpm_keymap -- cgit v1.2.3 From c5c2fa4fb5dbf242f94860ff5e2d40670560d0ae Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Mon, 9 May 2016 08:27:52 -0700 Subject: unposted: update documentary comments to remove references to self-insert-unmeta. --- ChangeLog | 5 +++++ Functions/Zle/bracketed-paste-magic | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'Functions/Zle/bracketed-paste-magic') diff --git a/ChangeLog b/ChangeLog index 9ddab6da6..0238e0664 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-05-09 Barton E. Schaefer + + * unposted: Functions/Zle/bracketed-paste-magic: update documentary + comments to remove references to self-insert-unmeta. + 2016-05-09 Frank Terbeck * 38422: Completion/Unix/Type/_baudrate, diff --git a/Functions/Zle/bracketed-paste-magic b/Functions/Zle/bracketed-paste-magic index 498cf554d..cafe18ed7 100644 --- a/Functions/Zle/bracketed-paste-magic +++ b/Functions/Zle/bracketed-paste-magic @@ -20,7 +20,7 @@ # active-widgets # Looked up in the context :bracketed-paste-magic to obtain a list of # patterns that match widget names that should be activated during the -# paste. All other key sequences are processed as self-insert-unmeta. +# paste. All other key sequences are processed as "zle .self-insert". # The default is 'self-*' so any user-defined widgets named with that # prefix are active along with the builtin self-insert. If this style is # not set (note: it must be explicitly deleted after loading this @@ -31,7 +31,7 @@ # # inactive-keys # This is the inverse of active-widgets, it lists key sequences that -# always use self-insert-unmeta even when bound to an active-widget. +# always use "zle .self-insert" even when bound to an active-widget. # Note that this is a list of literal key sequences, not patterns. # This style is in context :bracketed-paste-magic and has no default. # -- cgit v1.2.3 From 20948d088994dc7b26a26b94926432985fa6863e Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 9 Jun 2016 22:58:45 +0200 Subject: 38579: simplify saving and restoring of state --- ChangeLog | 3 +++ Functions/Zle/bracketed-paste-magic | 44 ++++++++++++++++--------------------- 2 files changed, 22 insertions(+), 25 deletions(-) (limited to 'Functions/Zle/bracketed-paste-magic') diff --git a/ChangeLog b/ChangeLog index 5063796f8..8c8a08948 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-06-09 Oliver Kiddle + * 38579: Functions/Zle/bracketed-paste-magic: simplify saving + and restoring of state + * 38641: Completion/Base/Utility/_values: allow for values which resemble compadd options diff --git a/Functions/Zle/bracketed-paste-magic b/Functions/Zle/bracketed-paste-magic index cafe18ed7..cf3cc6a59 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 + BUFFER= + CURSOR=1 + zle .split-undo + UNDO_LIMIT_NO=$UNDO_CHANGE_NO + 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 -- cgit v1.2.3 From 9cfd26bf10f530d746afadf3a04c4cf401fbbb9d Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Fri, 28 Oct 2016 16:44:35 -0700 Subject: unposted: handle empty pastes and "zle bracketed-paste variablename" form. --- ChangeLog | 5 +++++ Functions/Zle/bracketed-paste-magic | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'Functions/Zle/bracketed-paste-magic') diff --git a/ChangeLog b/ChangeLog index 45ab87de5..f7487f01a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,11 @@ * users/22036: Doc/Zsh/zle.yo: bracketed-paste: Document cutbuffer behaviour; clarify. +2016-10-27 Barton E. Schaefer + + * unposted: Functions/Zle/bracketed-paste-magic: handle empty + pastes and "zle bracketed-paste variablename" form. + 2016-10-27 Daniel Shahaf * unposted: Doc/Zsh/compsys.yo, Doc/Zsh/contrib.yo: Minor diff --git a/Functions/Zle/bracketed-paste-magic b/Functions/Zle/bracketed-paste-magic index cf3cc6a59..a82045e08 100644 --- a/Functions/Zle/bracketed-paste-magic +++ b/Functions/Zle/bracketed-paste-magic @@ -162,7 +162,7 @@ bracketed-paste-magic() { # There are active widgets. Reprocess $PASTED as keystrokes. NUMERIC=1 - zle -U - $PASTED + zle -U - "$PASTED" # Just in case there are active undo widgets @@ -206,7 +206,7 @@ bracketed-paste-magic() { # Reprocess $PASTED as an actual paste this time zle -U - $PASTED$'\e[201~' # append paste-end marker - zle .bracketed-paste + zle .bracketed-paste "$@" zle .split-undo # Arrange to display highlighting if necessary -- cgit v1.2.3 From 87c951c6bd5f889ec849ea45353969b407f8d5d5 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sat, 29 Oct 2016 10:08:53 -0700 Subject: unposted: add "--" to zle widget call for conventional sanity --- Functions/Zle/bracketed-paste-magic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Functions/Zle/bracketed-paste-magic') diff --git a/Functions/Zle/bracketed-paste-magic b/Functions/Zle/bracketed-paste-magic index a82045e08..fb584d595 100644 --- a/Functions/Zle/bracketed-paste-magic +++ b/Functions/Zle/bracketed-paste-magic @@ -206,7 +206,7 @@ bracketed-paste-magic() { # Reprocess $PASTED as an actual paste this time zle -U - $PASTED$'\e[201~' # append paste-end marker - zle .bracketed-paste "$@" + zle .bracketed-paste -- "$@" zle .split-undo # Arrange to display highlighting if necessary -- cgit v1.2.3