From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27542 invoked from network); 8 Apr 2000 20:55:33 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 8 Apr 2000 20:55:33 -0000 Received: (qmail 29092 invoked by alias); 8 Apr 2000 20:55:25 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10594 Received: (qmail 29073 invoked from network); 8 Apr 2000 20:55:24 -0000 From: "Bart Schaefer" Message-Id: <1000408205514.ZM22397@candle.brasslantern.com> Date: Sat, 8 Apr 2000 20:55:14 +0000 X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.auc.dk Subject: PATCH: $history index in prompt_bart_precmd MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii I finally exceeded my $HISTSIZE in one window and noticed that my prompt was no longer updating. $history behaves as an assoc indexed on the current history number, which means it gets leading empty elements as things fall off the front -- but $#history reflects the actual number of non-empty elements, e.g. it's never more than $HISTSIZE-1. There is, however, some kind of bug with interpretation of the keys for $history, because e.g. $history[3-1] == $history[3]. (It should yield the empty string, as there isn't any hash table value for key "3-1".) Index: Functions/Prompts/prompt_bart_setup =================================================================== @@ -57,8 +57,8 @@ setopt localoptions noxtrace extendedglob noksharrays # Using psvar here protects against unwanted promptsubst expansions. - psvar[8]="$history[$#history]" # Use history text, not just number - psvar[9]='' # Padding before upper right prompt + psvar[8]="$history[$[${(%):-%h}-1]]" # Use history text, not just number + psvar[9]='' # Padding before upper right prompt repeat $[COLUMNS-${#${(%%f)${PS1//[%]\{[^%]#%\}/}}[1]}-1] do -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com