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

[jjminar@xxxxxxxxxxx: Bug#266785: zsh: The elite2 prompt displays the tty incorrectly]



I'm gonna commit this instead, as I don't have a position on the "/" to
"|" change.


Index: Functions/Prompts/prompt_elite2_setup
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Prompts/prompt_elite2_setup,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 prompt_elite2_setup
--- Functions/Prompts/prompt_elite2_setup	18 Nov 1999 15:15:27 -0000	1.1.1.3
+++ Functions/Prompts/prompt_elite2_setup	24 Nov 2004 04:55:33 -0000
@@ -25,13 +25,12 @@
     : ${(P)varname=$(echo -n "\\0$code")}
   done
 
-  local tty=`tty|cut -d/ -f3`
   local text="%{$fg_no_bold[$text_col]%}"
   local parens="%{$fg_bold[$parens_col]%}"
   local punctuation_color="%{$fg_bold[grey]%}"
   local reset="%{$reset_color%}"
 
-  PS1="$punctuation_colorÚ$textÄ$parens($text%n$punctuation_color@$text%m$parens)$textÄ$parens($text%!$punctuation_color/$text$tty$parens)$textÄ$parens($text%D{%I:%M%P}$punctuation_color:$text%D{%m/%d/%y}$parens)$textÄ$punctuation_color-$reset$prompt_newline$punctuation_colorÀ$textÄ$parens($text%#$punctuation_color:$text%~$parens)$textÄ$punctuation_color-$reset " 
+  PS1="$punctuation_colorÚ$textÄ$parens($text%n$punctuation_color@$text%m$parens)$textÄ$parens($text%!$punctuation_color/$text%y$parens)$textÄ$parens($text%D{%I:%M%P}$punctuation_color:$text%D{%m/%d/%y}$parens)$textÄ$punctuation_color-$reset$prompt_newline$punctuation_colorÀ$textÄ$parens($text%#$punctuation_color:$text%~$parens)$textÄ$punctuation_color-$reset " 
 
   PS2="$parensÄ$textÄ$punctuation_color-$reset "
 

----- Forwarded message from Jan Minar <jjminar@xxxxxxxxxxx> -----

Date: Thu, 19 Aug 2004 07:32:37 +0200
From: Jan Minar <jjminar@xxxxxxxxxxx>
To: Debian Bug Tracking System <maintonly@xxxxxxxxxxxxxxx>
Subject: Bug#266785: zsh: The elite2 prompt displays the tty incorrectly

Package: zsh
Version: 4.0.4-33
Severity: minor
Tags: patch

The elite2 prompt is incorrect -- the tty bit is OK for /dev/*, but it
fails with /dev/*/* (devpts, i.e. all X terminals a.o.).  I see no
difference between using cut(1) and %y.  I also changed the delimiter,
so it plays more nicely with the fact the dashes are now part of the tty
name.

The incorrect prompt:

	(jan@kontryhel)(31337/pts)(05:15am:08/19/04)-
                              ^^^
The guilty line:

	local tty=`tty|cut -d/ -f3`
                               ^^^ should read -f3-

The corrected prompt:

	(jan@kontryhel)(31337|pts/1)(05:15am:08/19/04)-
                             ^   ^^
The patch:

--- /usr/share/zsh/4.0.4/functions/Prompts/prompt_elite2_setup.ORIG	Sat Jun 12 02:35:53 2004
+++ /usr/share/zsh/4.0.4/functions/Prompts/prompt_elite2_setup	Sat Jun 12 02:38:52 2004
@@ -25,13 +25,13 @@
     : ${(P)varname=$(echo -n "\\0$code")}
   done
 
-  local tty=`tty|cut -d/ -f3`
+  local tty=%y
   local text="%{$fg_no_bold[$text_col]%}"
   local parens="%{$fg_bold[$parens_col]%}"
   local punctuation_color="%{$fg_bold[grey]%}"
   local reset="%{$reset_color%}"
 
-  PS1="$punctuation_colorÚ$textÄ$parens($text%n$punctuation_color@$text%m$parens)$textÄ$parens($text%!$punctuation_color/$text$tty$parens)$textÄ$parens($text%D{%I:%M%P}$punctuation_color:$text%D{%m/%d/%y}$parens)$textÄ$punctuation_color-$reset$prompt_newline$punctuation_colorŔ$textÄ$parens($text%#$punctuation_color:$text%~$parens)$textÄ$punctuation_color-$reset " 
+  PS1="$punctuation_colorÚ$textÄ$parens($text%n$punctuation_color@$text%m$parens)$textÄ$parens($text%!$punctuation_color|$text$tty$parens)$textÄ$parens($text%D{%I:%M%P}$punctuation_color:$text%D{%m/%d/%y}$parens)$textÄ$punctuation_color-$reset$prompt_newline$punctuation_colorŔ$textÄ$parens($text%#$punctuation_color:$text%~$parens)$textÄ$punctuation_color-$reset " 
 
   PS2="$parensÄ$textÄ$punctuation_color-$reset "
 

Cheers,
Jan.

-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux kontryhel 2.4.27-jan #2 Tue Aug 17 11:10:35 CEST 2004 i686
Locale: LANG=C, LC_CTYPE=cs_CZ.ISO-8859-2

Versions of packages zsh depends on:
ii  libc6                    2.2.5-11.5      GNU C Library: Shared libraries an
ii  libcap1                  1:1.10-12       support for getting/setting POSIX.
ii  libncurses5              5.2.20020112a-7 Shared libraries for terminal hand

-- 
   "To me, clowns aren't funny. In fact, they're kind of scary. I've wondered
 where this started and I think it goes back to the time I went to the circus,
			  and a clown killed my dad."



----- End forwarded message -----



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