1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-10 00:31:07 +02:00

Greg Klanderman: 26964 (modified): PROMPT_EOL_MARK

This commit is contained in:
Peter Stephenson 2009-05-17 18:23:09 +00:00
parent 9169cd747f
commit a4106e0523
5 changed files with 35 additions and 14 deletions

View file

@ -1,3 +1,11 @@
2009-05-17 Peter Stephenson <p.w.stephenson@ntlworld.com>
* Greg Klanderman: 26964 (modified): Src/utils.c,
Doc/zsh/options.yo, Doc/Zsh/params.yo: make prompt
end-of-line configurable with PROMPT_EOL_MARK.
* Greg Klanderman: 26963: fix suffix handling for svn completion
2009-05-16 Peter Stephenson <p.w.stephenson@ntlworld.com> 2009-05-16 Peter Stephenson <p.w.stephenson@ntlworld.com>
* Paul Ackersviller: 26962: configure.ac, aczsh.m4, * Paul Ackersviller: 26962: configure.ac, aczsh.m4,
@ -11716,5 +11724,5 @@
***************************************************** *****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL * This is used by the shell to define $ZSH_PATCHLEVEL
* $Revision: 1.4687 $ * $Revision: 1.4688 $
***************************************************** *****************************************************

View file

@ -215,9 +215,8 @@ _svn_urls() {
_tags files _tags files
while _tags; do while _tags; do
while _next_label files expl ${suf:-directory}; do while _next_label files expl ${suf:-directory}; do
[[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf $remdispf && ret=0 [[ -n $suf ]] && compadd -S ' ' -q "$@" "$expl[@]" -d remdispf $remdispf && ret=0
compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \ compadd -S "${suf:+/}" -q "$@" "$expl[@]" -d remdispd ${remdispd%/} && ret=0
${remdispd%/} && ret=0
done done
(( ret )) || return 0 (( ret )) || return 0
done done

View file

@ -1307,16 +1307,18 @@ cindex(prompt, save partial lines)
item(tt(PROMPT_SP) <D>)( item(tt(PROMPT_SP) <D>)(
Attempt to preserve a partial line (i.e. a line that did not end with a Attempt to preserve a partial line (i.e. a line that did not end with a
newline) that would otherwise be covered up by the command prompt due to newline) that would otherwise be covered up by the command prompt due to
the PROMPT_CR option. This works by outputting some cursor-control the tt(PROMPT_CR) option. This works by outputting some cursor-control
characters, including a series of spaces, that should make the terminal characters, including a series of spaces, that should make the terminal
wrap to the next line when a partial line is present (note that this is wrap to the next line when a partial line is present (note that this is
only successful if your terminal has automatic margins, which is typical). only successful if your terminal has automatic margins, which is typical).
When a partial line is preserved, you will see an inverse+bold character at When a partial line is preserved, by default you will see an inverse+bold
the end of the partial line: a "%" for a normal user or a "#" for root. character at the end of the partial line: a "%" for a normal user or
a "#" for root. If set, the shell parameter tt(PROMPT_EOL_MARK) can be
used to customize how the end of partial lines are shown.
NOTE: if the PROMPT_CR option is not set, enabling this option will have no NOTE: if the tt(PROMPT_CR) option is not set, enabling this option will
effect. This option is on by default. have no effect. This option is on by default.
) )
pindex(PROMPT_PERCENT) pindex(PROMPT_PERCENT)
pindex(NO_PROMPT_PERCENT) pindex(NO_PROMPT_PERCENT)

View file

@ -1043,13 +1043,21 @@ vindex(prompt)
item(tt(prompt) <S> <Z>)( item(tt(prompt) <S> <Z>)(
Same as tt(PS1). Same as tt(PS1).
) )
vindex(PROMPT_EOL_MARK)
item(tt(PROMPT_EOL_MARK))(
When the tt(PROMPT_CR) and tt(PROMPT_SP) options are set, the
tt(PROMPT_EOL_MARK) parameter can be used to customize how the end of
partial lines are shown. This parameter undergoes prompt expansion, with
the tt(PROMPT_PERCENT) option set. If not set or empty, the default
behavior is equivalent to the value `tt(%B%S%#%s%b)'.
)
vindex(PS1) vindex(PS1)
item(tt(PS1) <S>)( item(tt(PS1) <S>)(
The primary prompt string, printed before a command is read. The primary prompt string, printed before a command is read.
the default is `tt(%m%# )'. It undergoes a special form of expansion It undergoes a special form of expansion
before being displayed; see before being displayed; see
ifzman(EXPANSION OF PROMPT SEQUENCES in zmanref(zshmisc))\ ifzman(EXPANSION OF PROMPT SEQUENCES in zmanref(zshmisc))\
ifnzman(noderef(Prompt Expansion)). ifnzman(noderef(Prompt Expansion)). The default is `tt(%m%# )'.
) )
vindex(PS2) vindex(PS2)
item(tt(PS2) <S>)( item(tt(PS2) <S>)(

View file

@ -1216,12 +1216,16 @@ preprompt(void)
* Unfortunately it interacts badly with ZLE displaying message * Unfortunately it interacts badly with ZLE displaying message
* when ^D has been pressed. So just disable PROMPT_SP logic in * when ^D has been pressed. So just disable PROMPT_SP logic in
* this case */ * this case */
char *eolmark = getsparam("PROMPT_EOL_MARK");
char *str; char *str;
int percents = opts[PROMPTPERCENT]; int percents = opts[PROMPTPERCENT], w = 0;
if (!eolmark || !*eolmark)
eolmark = "%B%S%#%s%b";
opts[PROMPTPERCENT] = 1; opts[PROMPTPERCENT] = 1;
str = promptexpand("%B%S%#%s%b", 0, NULL, NULL, NULL); str = promptexpand(eolmark, 1, NULL, NULL, NULL);
countprompt(str, &w, 0, -1);
opts[PROMPTPERCENT] = percents; opts[PROMPTPERCENT] = percents;
fprintf(shout, "%s%*s\r", str, (int)columns - 1 - !hasxn, ""); fprintf(shout, "%s%*s\r", str, (int)columns - w - !hasxn, "");
free(str); free(str);
} }