zsh-workers
 help / color / mirror / code / Atom feed
* Patch: Zle edit-command-line does not work with setopt GLOB_SUBST
@ 2018-12-18 17:42 Karsten Borgwaldt
  2018-12-18 20:34 ` Mikael Magnusson
  0 siblings, 1 reply; 2+ messages in thread
From: Karsten Borgwaldt @ 2018-12-18 17:42 UTC (permalink / raw)
  To: zsh-workers


[-- Attachment #1.1: Type: text/plain, Size: 654 bytes --]

Dear developers,

with "setopt GLOB_SUBST" the widget edit-command-line just prints an error and 
exits on my systems. Adding "noglob" to the function fixes it.

Tested environment:
Debian stretch with zsh 5.3.1 (x86_64-debian-linux-gnu)
Terminals:
  * Konsole 16.12.0 (TERM=xterm-256color)
  * XTerm(327) (TERM=xterm)

With both terminals the value of zle_bracketed_paste was
  ( $'\e[?2004h' $'\e[?2004l' )

Steps to reproduce:
# env -i TERM=$TERM zsh -f
# setopt glob_subst
# autoload -U edit-command-line
# edit-command-line
(anon):6: bad pattern: ^[[?2004l

Proposed fix is attached.

Feel free to ask me for additional information.

Regards
Karsten

[-- Attachment #1.2: edit-command-line-noglob.patch --]
[-- Type: text/x-patch, Size: 889 bytes --]

diff --git a/Functions/Zle/edit-command-line b/Functions/Zle/edit-command-line
index e17893e93..33b091aab 100644
--- a/Functions/Zle/edit-command-line
+++ b/Functions/Zle/edit-command-line
@@ -12,7 +12,7 @@
   # Compute the cursor's position in bytes, not characters.
   setopt localoptions nomultibyte noksharrays
 
-  (( $+zle_bracketed_paste )) && print -r -n - $zle_bracketed_paste[2]
+  (( $+zle_bracketed_paste )) && noglob print -r -n - $zle_bracketed_paste[2]
 
   # Open the editor, placing the cursor at the right place if we know how.
   local editor=( "${(@Q)${(z)${VISUAL:-${EDITOR:-vi}}}}" )
@@ -26,7 +26,7 @@
     (*) "${(@)editor}" $1;;
   esac
 
-  (( $+zle_bracketed_paste )) && print -r -n - $zle_bracketed_paste[1]
+  (( $+zle_bracketed_paste )) && noglob print -r -n - $zle_bracketed_paste[1]
 
   # Replace the buffer with the editor output.
   print -Rz - "$(<$1)" 

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Patch: Zle edit-command-line does not work with setopt GLOB_SUBST
  2018-12-18 17:42 Patch: Zle edit-command-line does not work with setopt GLOB_SUBST Karsten Borgwaldt
@ 2018-12-18 20:34 ` Mikael Magnusson
  0 siblings, 0 replies; 2+ messages in thread
From: Mikael Magnusson @ 2018-12-18 20:34 UTC (permalink / raw)
  To: Karsten Borgwaldt; +Cc: zsh-workers

On 12/18/18, Karsten Borgwaldt <kb@spambri.de> wrote:
> Dear developers,
>
> with "setopt GLOB_SUBST" the widget edit-command-line just prints an error
> and
> exits on my systems. Adding "noglob" to the function fixes it.
>
> Tested environment:
> Debian stretch with zsh 5.3.1 (x86_64-debian-linux-gnu)
> Terminals:
>   * Konsole 16.12.0 (TERM=xterm-256color)
>   * XTerm(327) (TERM=xterm)
>
> With both terminals the value of zle_bracketed_paste was
>   ( $'\e[?2004h' $'\e[?2004l' )
>
> Steps to reproduce:
> # env -i TERM=$TERM zsh -f
> # setopt glob_subst
> # autoload -U edit-command-line
> # edit-command-line
> (anon):6: bad pattern: ^[[?2004l
>
> Proposed fix is attached.
>
> Feel free to ask me for additional information.

You could use
emulate zsh -c 'autoload edit-command-line'
but the correct fix is to say 'emulate -L zsh' at the top of the
function itself.

-- 
Mikael Magnusson

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-12-18 20:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-18 17:42 Patch: Zle edit-command-line does not work with setopt GLOB_SUBST Karsten Borgwaldt
2018-12-18 20:34 ` Mikael Magnusson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).