From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23247 invoked from network); 4 Mar 2000 18:13:04 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 4 Mar 2000 18:13:04 -0000 Received: (qmail 5911 invoked by alias); 4 Mar 2000 18:12:50 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2947 Received: (qmail 5891 invoked from network); 4 Mar 2000 18:12:49 -0000 From: "Bart Schaefer" Message-Id: <1000304181244.ZM24879@candle.brasslantern.com> Date: Sat, 4 Mar 2000 18:12:43 +0000 In-Reply-To: <20000304132224.B12751@vin.ens-lyon.fr> Comments: In reply to Vincent Lefevre "Re: zsh tips for "UNIX Power Tools"" (Mar 4, 1:22pm) References: <28174.952013581@jpeek.com> <20000303123932.A11036@picard.franken.de> <87k8jjwt6h.fsf@cenderis.demon.co.uk> <20000304132224.B12751@vin.ens-lyon.fr> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-users@sunsite.auc.dk Subject: Re: zsh tips for "UNIX Power Tools" Cc: Jerry Peek MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Mar 4, 1:22pm, Vincent Lefevre wrote: } Subject: Re: zsh tips for "UNIX Power Tools" } } We can have a prompt on the left (the normal prompt), a part of } the prompt on the right, but can we have one below, that won't } be corrupted by the completions? What does "corrupted by completions" mean? Covered up by a listing? Having a prompt below the normal prompt is very tricky, because the output of any command that you run will begin on the same line where the "below" part of the prompt is. And of course if you edit a long line or a multiline buffer, the line editor needs to use that line, so there's really no way for zsh to "reserve" it. Here's a trick (usable only in 3.1.6-dev-19 or thereabouts, and later) that you may find interesting: self-insert() { zle .self-insert [[ -o always_last_prompt ]] && zle -R '' "Line: $((${#LBUFFER//[^ ]}+1)) / Column: ${#LBUFFER##* }" || return 0 } zle -N self-insert (Yes, those embedded newlines really should be there.) This uses the completion listing to keep a running display of the line and column at which you most recently inserted a character. ZLE knows how big a buffer it's editing, so it always places this output below the entire editable text. Of course this erases any existing completion listing every time you insert a character (though not every time you complete), but maybe you can live with that. Overriding the many other ZLE widgets to make motions, deletions, etc. also update the line and column is left as an excercise for the reader. Beware of other packages like `predict-on' (included with 3.1.6-dev-19) that also may attempt to redefine bindings in incompatible ways. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com