zsh-workers
 help / color / mirror / code / Atom feed
* New style completion bug when ctrl-C pressed
@ 2001-04-26 15:37 martin.ebourne
  2001-04-26 16:11 ` PATCH: " Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: martin.ebourne @ 2001-04-26 15:37 UTC (permalink / raw)
  To: zsh-workers


There appears to be a bug in the new style completion system whereby if you
abort the completion with Ctrl-C (as I often do if the machine is not
readily responding) it doesn't clear up after itself properly.

I have automenu disabled so the only time completion starts cycling through
a list of alternatives is if the approximate completer returns results.
However, sometimes after I've aborted a completion it somehow leaves
automenu on such that from then on all completions automatically cycle.

The cause would appear to be that a shell function is at some point
temporarily defined to override the builtin compadd - and this gets left
around. If I undefine it then normal service is resumed.

I've looked through the mailing lists, changelog, and even diffed the
completion functions against 4.0.1-pre-2 and didn't spot anything related
to this. I haven't tried running anything more recent than 3.1.9-dev-8
though (due to time).

I'm not on this list, so please CC me in any followups (especially fixes!).

Cheers,

Martin.

Possibly useful info:

% set | grep 'ZSH'

ZSH_NAME=zsh
ZSH_VERSION=3.1.9-dev-8

% uname -a

SunOS gdd-odybin2 5.6 Generic_105181-23 sun4u sparc SUNW,Ultra-Enterprise-10000

% zstyle

completer
        :completion:* _expand _complete _ignored _approximate _prefix
matcher-list
        :completion:* '' 'm:{a-zA-Z}={A-Za-z}'
list-colors
        :completion:*:default 'no=00' 'fi=38;5;11' 'di=38;5;14' 'ln=38;5;214' 'pi=38;5;218' 'so=38;5;218' 'bd=38;5;218' 'cd=38;5;218' 'ex=38;5;10' '
*.bat=38;5;10' '*.com=38;5;10' '*.cmd=38;5;10' '*.exe=38;5;10' '*.arj=38;5;15' '*.lzh=38;5;15' '*.tar=38;5;15' '*.tgz=38;5;15' '*.taz=38;5;15' '
*.Z=38;5;15' '*.z=38;5;15' '*.gz=38;5;15' '*.zip=38;5;15' '*.rpm=38;5;15' '*.deb=38;5;15' '*.a=38;5;12' '*.o=38;5;12' '*.d=38;5;12' '*.elc=38;5;12' '
*.zwc=38;5;12' '*core=01;38;5;9' '*~=38;5;245' '*.flc=38;5;245'
list-packed
        :completion:*:default true
glob
        :completion:*:expand:* 1
substitute
        :completion:*:expand:* 1
tag-order
        :completion:*:complete:cd:* '! path-directories'
        :completion:*:complete:-command-:* '! path-directories'
        :completion:*:expand:* all-expansions expansions original
        :completion:*:correct:* corrections original
add-space
        :completion:*:prefix:* true

% setopt

allexport             off
noalwayslastprompt    off
alwaystoend           off
noappendhistory       off
autocd                on
noautolist            off
noautomenu            on
autonamedirs          off
noautoparamkeys       off
noautoparamslash      off
autopushd             on
noautoremoveslash     off
autoresume            off
badpattern            on
banghist              on
bareglobqual          on
bashautolist          off
nobeep                off
bgnice                on
braceccl              off
bsdecho               off
cbases                off
cdablevars            on
chasedots             off
chaselinks            off
checkjobs             on
noclobber             off
completealiases       off
completeinword        on
correct               off
correctall            on
cshjunkiehistory      off
cshjunkieloops        off
cshjunkiequotes       off
cshnullcmd            off
cshnullglob           on
dvorak                off
equals                on
errexit               off
noexec                off
extendedglob          on
extendedhistory       on
noflowcontrol         off
functionargzero       on
noglob                off
globalexport          on
noglobalrcs           off
globassign            off
globcomplete          off
globdots              off
noglobsubst           on
nohashcmds            off
nohashdirs            off
nohashlistall         off
histallowclobber      off
nohistbeep            off
histexpiredupsfirst   off
histfindnodups        on
histignorealldups     on
histignoredups        on
histignorespace       off
histnofunctions       off
histnostore           on
histreduceblanks      off
histsavenodups        on
histverify            off
hup                   on
ignorebraces          off
ignoreeof             off
incappendhistory      off
interactive           on
nointeractivecomments off
noksharrays           on
nokshautoload         on
nokshglob             on
nokshoptionprint      off
nolistambiguous       off
nolistbeep            off
listpacked            on
listrowsfirst         off
nolisttypes           off
nolocaloptions        on
nolocaltraps          on
login                 off
longlistjobs          on
magicequalsubst       off
mailwarning           on
markdirs              on
menucomplete          off
monitor               on
multios               on
nomatch               on
notify                on
nullglob              off
numericglobsort       on
octalzeroes           off
overstrike            off
pathdirs              on
noposixbuiltins       on
printeightbit         off
printexitvalue        off
privileged            off
nopromptbang          on
nopromptcr            off
promptpercent         on
nopromptsubst         off
pushdignoredups       on
pushdminus            on
pushdsilent           off
pushdtohome           off
rcexpandparam         off
rcquotes              on
norcs                 off
recexact              off
restricted            off
normstarsilent        off
rmstarwait            off
nosharehistory        off
noshfileexpansion     on
noshglob              on
shinstdin             on
noshnullcmd           on
noshoptionletters     on
shortloops            on
noshwordsplit         on
singlecommand         off
nosinglelinezle       on
sunkeyboardhack       off
nounset               off
verbose               off
xtrace                off
zle                   on





This e-mail message is CONFIDENTIAL and may contain legally privileged
information.  If you are not the intended recipient you should not  read,
copy, distribute, disclose or otherwise use the information in this e-mail.
Please also telephone or fax us immediately and delete the message from
your system.  E-mail may be susceptible to data corruption, interception
and unauthorised amendment, and we do not accept liability for any such
corruption, interception or amendment or the consequences thereof.


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

* PATCH: Re: New style completion bug when ctrl-C pressed
  2001-04-26 15:37 New style completion bug when ctrl-C pressed martin.ebourne
@ 2001-04-26 16:11 ` Bart Schaefer
  2001-04-26 17:32   ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2001-04-26 16:11 UTC (permalink / raw)
  To: martin.ebourne, zsh-workers

On Apr 26,  4:37pm, martin.ebourne@arcordia.com wrote:
} 
} There appears to be a bug in the new style completion system whereby if you
} abort the completion with Ctrl-C (as I often do if the machine is not
} readily responding) it doesn't clear up after itself properly.
} 
} The cause would appear to be that a shell function is at some point
} temporarily defined to override the builtin compadd - and this gets left
} around.

Try this.  (Doesn't seem worthwhile to do the same for _complete_help, but
maybe we should consider it.)


diff -ru zsh-forge/current/Completion/Base/Completer/_approximate zsh-4.0/Completion/Base/Completer/_approximate
--- zsh-forge/current/Completion/Base/Completer/_approximate	Mon Apr  2 04:05:44 2001
+++ zsh-4.0/Completion/Base/Completer/_approximate	Thu Apr 26 09:03:30 2001
@@ -61,6 +61,7 @@
     # fi
     builtin compadd "$_correct_expl[@]" "$@"
   }
+  trap '[[ -n "$redef" ]] && unfunction compadd' EXIT INT
 fi
 
 _comp_correct=1
@@ -92,7 +93,6 @@
       [[ "$compstate[list]" != list* ]] &&
           compstate[list]="$compstate[list] force"
     fi
-    [[ -n "$redef" ]] && unfunction compadd
     compstate[pattern_match]="$opm"
 
     return 0
@@ -102,7 +102,6 @@
   (( _comp_correct++ ))
 done
 
-[[ -n "$redef" ]] && unfunction compadd
 compstate[pattern_match]="$opm"
 
 return 1

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

* Re: PATCH: Re: New style completion bug when ctrl-C pressed
  2001-04-26 16:11 ` PATCH: " Bart Schaefer
@ 2001-04-26 17:32   ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2001-04-26 17:32 UTC (permalink / raw)
  To: martin.ebourne, zsh-workers

On Apr 26,  4:11pm, Bart Schaefer wrote:
}
} Try this.

I'm not doing very well with my posted patches the last couple of days.

} +  trap '[[ -n "$redef" ]] && unfunction compadd' EXIT INT

The trap doesn't execute in the local scope, so [[ -n $redef ]] always
fails.  Try this instead:

diff -rux CVS zsh-forge/current/Completion/Base/Completer/_approximate zsh-4.0/Completion/Base/Completer/_approximate
--- zsh-forge/current/Completion/Base/Completer/_approximate	Mon Apr  2 04:05:44 2001
+++ zsh-4.0/Completion/Base/Completer/_approximate	Thu Apr 26 10:31:02 2001
@@ -10,7 +10,7 @@
 
 [[ _matcher_num -gt 1 || "${#:-$PREFIX$SUFFIX}" -le 1 ]] && return 1
 
-local _comp_correct _correct_expl comax cfgacc redef match
+local _comp_correct _correct_expl comax cfgacc match
 local oldcontext="${curcontext}" opm="$compstate[pattern_match]"
 
 if [[ "$1" = -a* ]]; then
@@ -48,7 +48,6 @@
 # ignored prefix).
 
 if (( ! $+functions[compadd] )); then
-  redef=yes
   compadd() {
     [[ ${argv[(I)-[a-zA-Z]#U[a-zA-Z]#]} -eq 0 &&
        "${#:-$PREFIX$SUFFIX}" -le _comp_correct ]] && return
@@ -61,6 +60,7 @@
     # fi
     builtin compadd "$_correct_expl[@]" "$@"
   }
+  trap 'unfunction compadd' EXIT INT
 fi
 
 _comp_correct=1
@@ -92,7 +92,6 @@
       [[ "$compstate[list]" != list* ]] &&
           compstate[list]="$compstate[list] force"
     fi
-    [[ -n "$redef" ]] && unfunction compadd
     compstate[pattern_match]="$opm"
 
     return 0
@@ -102,7 +101,6 @@
   (( _comp_correct++ ))
 done
 
-[[ -n "$redef" ]] && unfunction compadd
 compstate[pattern_match]="$opm"
 
 return 1

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

end of thread, other threads:[~2001-04-26 17:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-26 15:37 New style completion bug when ctrl-C pressed martin.ebourne
2001-04-26 16:11 ` PATCH: " Bart Schaefer
2001-04-26 17:32   ` Bart Schaefer

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).