mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-02 22:11:54 +02:00
Greg Klanderman: 26964 (modified): PROMPT_EOL_MARK
This commit is contained in:
parent
9169cd747f
commit
a4106e0523
5 changed files with 35 additions and 14 deletions
10
ChangeLog
10
ChangeLog
|
@ -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>
|
||||
|
||||
* Paul Ackersviller: 26962: configure.ac, aczsh.m4,
|
||||
|
@ -11716,5 +11724,5 @@
|
|||
|
||||
*****************************************************
|
||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||
* $Revision: 1.4687 $
|
||||
* $Revision: 1.4688 $
|
||||
*****************************************************
|
||||
|
|
|
@ -215,9 +215,8 @@ _svn_urls() {
|
|||
_tags files
|
||||
while _tags; do
|
||||
while _next_label files expl ${suf:-directory}; do
|
||||
[[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf $remdispf && ret=0
|
||||
compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \
|
||||
${remdispd%/} && ret=0
|
||||
[[ -n $suf ]] && compadd -S ' ' -q "$@" "$expl[@]" -d remdispf $remdispf && ret=0
|
||||
compadd -S "${suf:+/}" -q "$@" "$expl[@]" -d remdispd ${remdispd%/} && ret=0
|
||||
done
|
||||
(( ret )) || return 0
|
||||
done
|
||||
|
|
|
@ -1307,16 +1307,18 @@ cindex(prompt, save partial lines)
|
|||
item(tt(PROMPT_SP) <D>)(
|
||||
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
|
||||
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
|
||||
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).
|
||||
|
||||
When a partial line is preserved, you will see an inverse+bold character at
|
||||
the end of the partial line: a "%" for a normal user or a "#" for root.
|
||||
When a partial line is preserved, by default you will see an inverse+bold
|
||||
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
|
||||
effect. This option is on by default.
|
||||
NOTE: if the tt(PROMPT_CR) option is not set, enabling this option will
|
||||
have no effect. This option is on by default.
|
||||
)
|
||||
pindex(PROMPT_PERCENT)
|
||||
pindex(NO_PROMPT_PERCENT)
|
||||
|
|
|
@ -1043,13 +1043,21 @@ vindex(prompt)
|
|||
item(tt(prompt) <S> <Z>)(
|
||||
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)
|
||||
item(tt(PS1) <S>)(
|
||||
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
|
||||
ifzman(EXPANSION OF PROMPT SEQUENCES in zmanref(zshmisc))\
|
||||
ifnzman(noderef(Prompt Expansion)).
|
||||
ifnzman(noderef(Prompt Expansion)). The default is `tt(%m%# )'.
|
||||
)
|
||||
vindex(PS2)
|
||||
item(tt(PS2) <S>)(
|
||||
|
|
10
Src/utils.c
10
Src/utils.c
|
@ -1216,12 +1216,16 @@ preprompt(void)
|
|||
* Unfortunately it interacts badly with ZLE displaying message
|
||||
* when ^D has been pressed. So just disable PROMPT_SP logic in
|
||||
* this case */
|
||||
char *eolmark = getsparam("PROMPT_EOL_MARK");
|
||||
char *str;
|
||||
int percents = opts[PROMPTPERCENT];
|
||||
int percents = opts[PROMPTPERCENT], w = 0;
|
||||
if (!eolmark || !*eolmark)
|
||||
eolmark = "%B%S%#%s%b";
|
||||
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;
|
||||
fprintf(shout, "%s%*s\r", str, (int)columns - 1 - !hasxn, "");
|
||||
fprintf(shout, "%s%*s\r", str, (int)columns - w - !hasxn, "");
|
||||
free(str);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue