From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14725 invoked from network); 24 Mar 2004 16:45:40 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 24 Mar 2004 16:45:40 -0000 Received: (qmail 11828 invoked by alias); 24 Mar 2004 16:45:18 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7256 Received: (qmail 11734 invoked from network); 24 Mar 2004 16:45:17 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 24 Mar 2004 16:45:17 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [130.225.247.86] by sunsite.dk (MessageWall 1.0.8) with SMTP; 24 Mar 2004 16:45:17 -0000 Received: (qmail 30946 invoked from network); 24 Mar 2004 16:45:16 -0000 Received: from wbar3.sjo1-4-11-009-147.sjo1.dsl-verizon.net (HELO candle.brasslantern.com) (4.11.9.147) by a.mx.sunsite.dk with SMTP; 24 Mar 2004 16:45:13 -0000 Received: (from schaefer@localhost) by candle.brasslantern.com (8.11.6/8.11.6) id i2OGjCH15771 for zsh-users@sunsite.dk; Wed, 24 Mar 2004 08:45:12 -0800 X-Authentication-Warning: candle.brasslantern.com: schaefer set sender to schaefer@closedmail.com using -f From: Bart Schaefer Message-Id: <1040324164511.ZM15770@candle.brasslantern.com> Date: Wed, 24 Mar 2004 16:45:11 +0000 In-Reply-To: Comments: In reply to Thorsten Kampe "Problem with 'predict-on'" (Mar 24, 5:18am) References: X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-users@sunsite.dk Subject: Re: Problem with 'predict-on' MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: **** X-Spam-Status: No, hits=4.7 required=6.0 tests=RCVD_IN_DYNABLOCK, RCVD_IN_NJABL,RCVD_IN_NJABL_DIALUP,RCVD_IN_SORBS autolearn=no version=2.63 X-Spam-Hits: 4.7 On Mar 24, 5:18am, Thorsten Kampe wrote: } } I'm testing the ZLE widget "predict-on" with... predict-on is probably due for an overhaul. It was written for 3.1.x (I've forgotten which value of 'x') and only updated once about a year ago. } autoload -U predict-on; predict-on } This means that predict-on is active by default. Actually a better way to accomplish this is zle-line-init() { predict-on } zle -N zle-line-init Calling predict-on in .zshrc means it's on for the very first prompt, but zle-line-init makes sure it's on at the beginning of every prompt. Ideally, predict-on would give an error if it is called anywhere other than in a widget, but the zle-line-init special widget didn't exist when predict-on was created. } But there are some flaws with predict-on: Yes, several. You'll also notice that it doesn't interact very well with "undo". (PWS or Wayne, if you're reading this, advice on how to fix that would be appreciated.) I've also just noticed a new problem with backspacing, one which I'm quite sure has appeared quite recently ... I'm reporting that in another message to zsh-workers right now. } first of all I can not backspace the first } character I typed in the command line. Yes, that's true. If there isn't at least one character, there's no basis for predictive typing. So the choices would be to delete the entire line when the first character is deleted, or ... I'm not sure what. If "delete the entire line" seems like the right thing, try this patch: Index: predict-on =================================================================== RCS file: /extra/cvsroot/zsh/zsh-4.0/Functions/Zle/predict-on,v retrieving revision 1.2 diff -c -r1.2 predict-on --- predict-on 15 Mar 2003 17:43:15 -0000 1.2 +++ predict-on 24 Mar 2004 16:08:52 -0000 @@ -120,6 +120,8 @@ zle .history-beginning-search-forward || RBUFFER="" return 0 fi + else + zle .kill-whole-line fi } delete-no-predict() { However, that may not be very helpful until the history-search bug gets fixed. } Then pasting text via } [Shift]-[Ins] doesn't turn off prediction (like it should[1]). This probably means that ((PENDING)) doesn't work correctly on your system, or that the implemention of Shift+Ins is such that the pasted text does not appear as typeahead. PENDING (integer) The number of bytes pending for input, i.e. the number of bytes which have already been typed and can immediately be read. On systems where the shell is not able to get this information, this parameter will always have a value of zero. Read-only. Unfortunately if insert-and-predict can't determine that there is more than a single character being inserted, it doesn't know that a paste is happening, and so doesn't turn itself off.