From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13481 invoked from network); 4 Jan 1999 09:32:06 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 4 Jan 1999 09:32:06 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id EAA01086; Mon, 4 Jan 1999 04:30:51 -0500 (EST) Resent-Date: Mon, 4 Jan 1999 04:30:51 -0500 (EST) Date: Mon, 4 Jan 1999 10:29:22 +0100 (MET) Message-Id: <199901040929.KAA09706@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@math.gatech.edu In-reply-to: "Bart Schaefer"'s message of Sun, 3 Jan 1999 18:14:36 -0800 Subject: PATCH: was Re: zsh-3.1.5-pws4. accept-and-menu-complete bug? Resent-Message-ID: <"TxH3g.0.sG.Bf8as"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4878 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Bart Schaefer wrote: > > On Dec 31, 10:58am, Andrej Borsenkow wrote: > } Subject: zsh-3.1.5-pws4. accept-and-menu-complete bug? > } > } bor@itsrm2:/tools/src%> bindkey '^[^M' > } "^[^M" accept-and-menu-complete > } bor@itsrm2:/tools/src%> rm -rf mc-4.5.1/^@mc-4.5.3/ > } mc-4.5.1/ mc-4.5.3/ > } > } Note this ^@ and not removed suffix instead of blank. > > In acceptandmenucomplete() in zle_tricky.c, there's this fragment: > > cs = menuend + menuinsc; > inststrlen(" ", 1, 1); > menuinsc = menulen = 0; > menupos = cs; > > menuend is supposed to be "the end position of this string in the command > line" and menuinsc "is the length of any suffix that has been temporarily > added." However, at that point menuend is large enough to *include* the > trailing slash. In 3.0.5's acceptandmenucomplete(), menuinsc is not added > when computing cs. > > So I don't know if this is a general problem -- that menuend is just plain > wrong, and anything that refers to it will be messed up -- or if that ref > to menuinsc crept in by mistake and should be deleted (in which case the > suffix doesn't get autoremoved), or if there's a whole lot of suffix-removal > code that ought to be copied from 3.0.5, or what. It seems that I forgot to test accept-and-menu-complete in the final version of my patch, sorry. `menuend' now points to the position where the cursor is (which may be in the word, e.g. for completion in paths). The patch below fixes a bug in the calculation of `menuend' in do_single() and the stuff in acceptandmenucomplete() (positioning the cursor and removing the suffix). Bye Sven *** os/Zle/zle_tricky.c Thu Dec 17 12:20:33 1998 --- Src/Zle/zle_tricky.c Mon Jan 4 10:19:19 1999 *************** *** 408,418 **** void acceptandmenucomplete(void) { if (!menucmp) { feep(); return; } ! cs = menuend + menuinsc; inststrlen(" ", 1, 1); menuinsc = menulen = 0; menupos = cs; --- 408,422 ---- void acceptandmenucomplete(void) { + int sl = suffixlen[' ']; + if (!menucmp) { feep(); return; } ! cs = menupos + menulen + menuinsc; ! if (sl) ! backdel(sl); inststrlen(" ", 1, 1); menuinsc = menulen = 0; menupos = cs; *************** *** 4991,5000 **** if (m->suf) { havesuff = 1; menuinsc = ztrlen(m->suf); ! if (menuwe && (m->flags & CMF_REMOVE)) { ! makesuffix(menuinsc); ! if (menuinsc == 1) ! suffixlen[m->suf[0]] = 1; } } else { /* There is no user-specified suffix, * --- 4995,5008 ---- if (m->suf) { havesuff = 1; menuinsc = ztrlen(m->suf); ! menulen -= menuinsc; ! if (menuwe) { ! menuend += menuinsc; ! if (m->flags & CMF_REMOVE) { ! makesuffix(menuinsc); ! if (menuinsc == 1) ! suffixlen[m->suf[0]] = 1; ! } } } else { /* There is no user-specified suffix, * -- Sven Wischnowsky wischnow@informatik.hu-berlin.de