Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: On the topic of prompts
- X-seq: zsh-users 291
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: unpingco@xxxxxxxxxxxx (Jose Unpingco)
- Subject: Re: On the topic of prompts
- Date: Fri, 12 Jul 1996 19:42:16 -0700
- Cc: zsh-users@xxxxxxxxxxxxxxx
- In-reply-to: unpingco@xxxxxxxxxxxx (Jose Unpingco) "Re: On the topic of prompts" (Jul 12, 11:36am)
- References: <9607121836.AA10161@xxxxxxxxxxxxxxxxx>
- Reply-to: schaefer@xxxxxxx
On Jul 12, 11:36am, Jose Unpingco wrote:
} Subject: Re: On the topic of prompts
}
} I've thought about sticking a highlighted status line on the last line
} of a vt100 or xterm which would contain handy info like PWD, but I
} could never figure out how. Could you be more specific about what you
} mention below? I've never programmed a terminal before and I'm not
} sure what you mean by games with the "termcap sequences".
Since programming a terminal is not something I do for entertainment,
I was hoping *not* to be specific. :-) However:
If you look at the termcap database, the "cs" capability is the "change
scrolling region" escape sequence. So, supposing you have an 80x24
screen, AND your terminal supports scrolling regions, AND your termcap
is complete enough to include the "cs" capability (many aren't), THEN
you can do this sort of thing:
# Remember that zsh numbers lines/columns from 0 (zero)!
# Also, for some reason, zsh reads termcap args in reverse order,
# so although the cs string wants to use 1;23, zsh has to be told
# 23 and then 1. Similarly for cm. Is this a bug?
precmd() {
echotc cs $[$LINES-1] 1 # Set scrolling region
echotc cm 0 0 # Move cursor to first line
print -nP "%S$ZSH_NAME $ZSH_VERSION%s %h %m %n %W %@"
echotc cm 0 $[$LINES-1] # Move cursor to last line
}
One thing you have to remember is to reset the scrolling region to the
full screen before you run commands like "less", "more", or "vi". That
means you may have to set up a whole bunch of functions like:
more() {
[[ -t 1 ]] && echotc cs $[$LINES-1] 0 # Full-screen scroll
command more $*
}
Also note that strange things may happen if you try to print more than
one line into the space above the scrolling region.
Specific enough?
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.nbn.com/people/lantern
New male in /home/schaefer:
>N 2 Justin William Schaefer Sat May 11 03:43 53/4040 "Happy Birthday"
Messages sorted by:
Reverse Date,
Date,
Thread,
Author