* resent: pws-22: hash key completion in brackets
@ 1999-06-17 8:43 Andrej Borsenkow
0 siblings, 0 replies; 2+ messages in thread
From: Andrej Borsenkow @ 1999-06-17 8:43 UTC (permalink / raw)
To: ZSH workers mailing list
[how easy it is to completely screw up your mail server :-) looks, like this one
iwas lost as well]
It cannot complete inside of closed brackets:
bor@itsrm2:~%> typeset -A foo
bor@itsrm2:~%> foo[bar]=1
bor@itsrm2:~%> foo[baz]=2
bor@itsrm2:~%> unset foo[b<TAB>
bor@itsrm2:~%> unset foo[ba
bar baz
but
bor@itsrm2:~%> unset foo[ba<TAB>]
Beep
/andrej
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: resent: pws-22: hash key completion in brackets
@ 1999-06-17 9:17 Sven Wischnowsky
0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 1999-06-17 9:17 UTC (permalink / raw)
To: zsh-workers
Andrej Borsenkow wrote:
> bor@itsrm2:~%> unset foo[ba<TAB>]
> Beep
Yes, wrong test for the closing bracket in get_comp_string().
Bye
Sven
diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c Thu Jun 17 09:24:31 1999
+++ Src/Zle/zle_tricky.c Thu Jun 17 11:04:37 1999
@@ -1484,11 +1484,14 @@
if (lev)
lev--;
}
- wb++;
p = (char *) line + wb;
+ wb++;
if (wb && (*p == '[' || *p == '(') &&
- !skipparens(*p, (*p == '[' ? ']' : ')'), &p))
- we = p - (char *) line;
+ !skipparens(*p, (*p == '[' ? ']' : ')'), &p)) {
+ we = (p - (char *) line) - 1;
+ if (insubscr == 2)
+ insubscr = 3;
+ }
} else {
/* In mathematical expression, we complete parameter names *
* (even if they don't have a `$' in front of them). So we *
@@ -1513,9 +1516,10 @@
varname = ztrdup((char *) line + i + 1);
line[wb - 1] = sav;
if ((keypm = (Param) paramtab->getnode(paramtab, varname)) &&
- (keypm->flags & PM_HASHED))
- insubscr = 2;
- else
+ (keypm->flags & PM_HASHED)) {
+ if (insubscr != 3)
+ insubscr = 2;
+ } else
insubscr = 1;
}
}
@@ -5281,10 +5285,10 @@
cc = &cc_default;
keypm = NULL;
} else if (linwhat == IN_MATH) {
- if (insubscr == 2) {
+ if (insubscr >= 2) {
/* Inside subscript of assoc array, complete keys. */
cc_dummy.mask = 0;
- cc_dummy.suffix = "]";
+ cc_dummy.suffix = (insubscr == 2 ? "]" : "");
} else {
/* Other math environment, complete paramete names. */
keypm = NULL;
diff -u oc/Base/_subscript Completion/Base/_subscript
--- oc/Base/_subscript Thu Jun 17 09:24:53 1999
+++ Completion/Base/_subscript Thu Jun 17 11:15:19 1999
@@ -1,7 +1,11 @@
#compdef -subscript-
if [[ ${(Pt)${compstate[parameter]}} = assoc* ]]; then
- compadd -S ']' - "${(@kP)${compstate[parameter]}}"
+ if [[ "$RBUFFER" = \]* ]]; then
+ compadd -S '' - "${(@kP)${compstate[parameter]}}"
+ else
+ compadd -S ']' - "${(@kP)${compstate[parameter]}}"
+ fi
else
_compalso -math-
fi
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1999-06-17 9:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-17 8:43 resent: pws-22: hash key completion in brackets Andrej Borsenkow
1999-06-17 9:17 Sven Wischnowsky
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).