Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Problem with multi-line PROMPT in zsh-3.0.2
- X-seq: zsh-workers 2765
- From: "Karl E. Vogel" <vogelke@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx
- Subject: Problem with multi-line PROMPT in zsh-3.0.2
- Date: Thu, 9 Jan 1997 18:46:56 -0500 (EST)
>> On Sun, 29 Dec 1996 03:42:53 +0100 (MET),
>> Zoltan Hidvegi <hzoli@xxxxxxxxxx> said:
Z> I'll probably make zsh-3.0.3 later next year :-).
Cool. I've found a minor problem running 3.0.2 on a Sparc-5 under
Solaris-2.5.1. I have a multi-line prompt, and it gets messed up when I do
a backwards history search or (occasionally) when I scroll through history.
It doesn't happen if I reset PROMPT to something that fits on a single
line.
My PROMPT string gets set like this:
month=`date +%b`
export tty=`tty`
export tty=`basename $tty`
PROMPT="
(%w $month %*) <%?> [%~] $program
%n at %m.%l ($SHLVL-%!-z)%# "
I know the "tty" stuff looks clumsy, but I use bash, tcsh, and zsh; they
don't all use the same symbols to specify terminal name, etc.
A typical prompt appears like this on my screen:
(Thu 2 Jan 15:53:05) <0> [~]
vogelke at ss118.pts/0 (1-2246-z)% echo hi
hi
(Thu 2 Jan 15:53:11) <0> [~]
vogelke at ss118.pts/0 (1-2247-z)%
Let's say my history list looks like this:
1987 mv selrecap.pdf selrecap.pdf.done
1988 dir
1989 j
1990 2
1991 j
1992 cd
1993 j
1994 mb
1995 frm
1996 lpq
1997 df
1998 j
1999 exit
2000 xsetroot -solid gray
2001 j
2002 mis
2003 frm
Then I look for "selr" which should match line 1987. Pressing ^R gives me
the regular search prompt, and then pressing "s" matches line 2002:
(Thu 2 Jan 15:55:26) <0> [~]
vogelke at ss118.pts/1 (1-2005-z)% mis
bck-i-search: s_
Pressing "e" matches line 2000 which is displayed properly. Pressing "l"
gives the following display:
(Thu 2 Jan 15:55:26) <0> [~]
vogelke at ss118.pts/1 (1-2005-z)% mv selrecap.pdf selrecap.pdf.done
(Thu 2 Jan 15:55:26) <0> [~]
vogelke at ss118.pts/1 (1-2005-z)% mv selrecap.pdf _
^
CURSOR
Adding more characters occasionally re-inserts the "bck-i-search" line in
the middle of one of the prompts. This happens whether the cursor is at the
top, middle, or bottom of the screen, so it's not a matter of odd
curses/termcap behavior at a screen boundary.
I run the following commands to set up my terminal, which is a Sun console:
# Control keys.
stty 9600 -tabs erase ^? kill ^U susp ^Z intr ^C
stty rows 41
# TERM must be set last, or the shell gets REALLY confused.
export TERMINFO=/usr/local/lib/terminfo
export TERMCAP=$TERMINFO/sun-new.cap
export TERM=sun
Here's the "sun-new.cap" file:
# Got this from terminfo description supplied with ncurses.
# Ran tic on that description, then "infocmp -Cr1 sun" to get this.
#
# To generate terminfo description:
# captoinfo file.cap > file.info
#
# To compile the terminfo entry for use:
# tic file.info
#
# Had to change clear character from formfeed to \E[H\E[J for it
# to work; got this from the screen code, but I don't know why.
#
# Sun Nov 5 15:00:47 EST 1995
#
# Location Keyname Termcap name
# --------------------------------------------------
# F1-F9 Function keys k1-k9
# F10 Function keys k;
# F11 Function keys F1
# F12 Function keys F2
# Help Help %1
#
# Keypad / Find @0
# Keypad * Cancel @2
# Keypad + Create @6
# Keypad Enter Enter @8
# Keypad - Exit @9
#
# Up arrow - ku
# Down arrow - kd
# Right arrow - kr
# Left arrow - kl
# Home - kh
# End - @7
#
sun|Sun Microsystems Workstation console:\
:%1=\E[207z:\
:@0=\E[212z:\
:@2=\E[213z:\
:@6=\E[253z:\
:@7=\E[220z:\
:@8=\E[250z:\
:@9=\E[254z:\
:AL=\E[%dL:\
:DC=\E[%dP:\
:DL=\E[%dM:\
:F1=\E[234z:\
:F2=\E[235z:\
:IC=\E[%d@:\
:al=\E[L:\
:am:\
:bl=^G:\
:cd=\E[J:\
:ce=\E[K:\
:cl=\E[H\E[J:\
:cm=\E[%i%d;%dH:\
:co#80:\
:cr=^M:\
:dc=\E[P:\
:dl=\E[M:\
:do=\E[B:\
:ei=:\
:ic=\E[@:\
:im=:\
:is=\E[1r:\
:it#8:\
:k1=\E[224z:\
:k2=\E[225z:\
:k3=\E[226z:\
:k4=\E[227z:\
:k5=\E[228z:\
:k6=\E[229z:\
:k7=\E[230z:\
:k8=\E[231z:\
:k9=\E[232z:\
:k;=\E[233z:\
:kI=\E[247z:\
:kN=\E[222z:\
:kP=\E[216z:\
:kd=\E[B:\
:kh=\E[214z:\
:kl=\E[D:\
:km:\
:kr=\E[C:\
:ku=\E[A:\
:le=^H:\
:li#41:\
:mi:\
:ms:\
:nd=\E[C:\
:se=\E[m:\
:sf=^J:\
:so=\E[7m:\
:ta=^I:\
:up=\E[A:
The equivalent entry is also used in terminfo. The only real difference
from the ncurses "sun" entry is using a screen-length of 41 lines.
When logging in, I use the following X setup commands:
olvwm &
# Main terminal session, upper left corner.
# I want this window to be the owner of the session, so it starts last.
# xterm options:
# -fn 10x20 selects comfortable font
# -b 10 give me a 10-pixel border around window
# -j use jump-scrolling (faster)
# -sb give me a scroll-bar
# -sf use Sun function key escape codes
termopts="-fn 10x20 -b 10 -j -sb -sf"
xterm -g 80x41+150+0 $termopts -title "`uname -n`"
I've tried compiling with and without ncurses, but that doesn't help.
I did put in the first patch you issued concerning the setvbuf() call for
stdout.
Other than that, the shell works dandy. My prompt string and terminal
setup is exactly the same for zsh-2.6-beta12, which didn't display the
problem.
--
Karl Vogel vogelke@xxxxxxxxxxxxxxxx
ASC/YCOA, Wright-Patterson AFB, OH 45433 937-255-3688
Messages sorted by:
Reverse Date,
Date,
Thread,
Author