From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17073 invoked from network); 17 Jun 1999 09:18:28 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 17 Jun 1999 09:18:28 -0000 Received: (qmail 1375 invoked by alias); 17 Jun 1999 09:17:55 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6689 Received: (qmail 1359 invoked from network); 17 Jun 1999 09:17:54 -0000 Date: Thu, 17 Jun 1999 11:17:53 +0200 (MET DST) Message-Id: <199906170917.LAA07293@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Andrej Borsenkow"'s message of Thu, 17 Jun 1999 12:43:24 +0400 Subject: Re: resent: pws-22: hash key completion in brackets Andrej Borsenkow wrote: > bor@itsrm2:~%> unset foo[ba] > 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