Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: did the way arrays get indexed change between 4.2 and 4.3?



On 25/07/07, William Scott <wgscott@xxxxxxxxxxxxxxxxxx> wrote:
I am using zsh-4.3.4

I am using the following function to put the current working
directory and penultimate directory in a tab on iTerm (also works
with Konsole):

settab () {
         tab_label="$PWD:h:t/$PWD:t"
         rlength="20"
         echo -ne "\e]1;$tab_label[-$rlength,-1]\a"
}

The idea is that if the string is longer than 20 characters, it
truncates it from the right, instead of the left (default behavior).

On 4.3.4 this works great.  On 4.2.3, if the original string has
fewer than 20 characters, the tab is blank.

Is there a decent work-around, as I hate to conditionally test for
the zsh version every time the tab dynamically updates.

I don't know the real answer, but you can at least do it the other way around.
Ie, define a different settab depending on zsh version when the rc
file is parsed.

--
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author