zsh-workers
 help / color / mirror / code / Atom feed
* PROMPT_SP and empty PROMPT_EOL_MARK
@ 2010-12-05 21:10 Mikael Magnusson
  2010-12-05 21:41 ` Bart Schaefer
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Mikael Magnusson @ 2010-12-05 21:10 UTC (permalink / raw)
  To: zsh workers

The recent patches to PROMPT_SP broke my local hacks that removed the
ugly % sign, so I found out about PROMPT_EOL_MARK but why on earth
does it

              If not set or empty, the default  behavior
              is equivalent to the value `%B%S%#%s%b'.

What is the rationale for disallowing an empty indicator? If someone
wants the default they can just unset the parameter.

diff --git a/Src/utils.c b/Src/utils.c
index 8e557fd..8a2db5e 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -1285,7 +1285,7 @@ preprompt(void)
        char *eolmark = getsparam("PROMPT_EOL_MARK");
        char *str;
        int percents = opts[PROMPTPERCENT], w = 0;
-       if (!eolmark || !*eolmark)
+       if (!eolmark)
            eolmark = "%B%S%#%s%b";
        opts[PROMPTPERCENT] = 1;
        str = promptexpand(eolmark, 1, NULL, NULL, NULL);
diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index 5d85f58..bec0027 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -1158,7 +1158,7 @@ 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
+the tt(PROMPT_PERCENT) option set.  If not set, the default
 behavior is equivalent to the value `tt(%B%S%#%s%b)'.
 )
 vindex(PS1)


-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PROMPT_SP and empty PROMPT_EOL_MARK
  2010-12-05 21:10 PROMPT_SP and empty PROMPT_EOL_MARK Mikael Magnusson
@ 2010-12-05 21:41 ` Bart Schaefer
  2010-12-05 21:50 ` Wayne Davison
  2010-12-06 20:35 ` Greg Klanderman
  2 siblings, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 2010-12-05 21:41 UTC (permalink / raw)
  To: zsh workers

On Dec 5, 10:10pm, Mikael Magnusson wrote:
}
}               If not set or empty, the default  behavior
}               is equivalent to the value `%B%S%#%s%b'.
} 
} What is the rationale for disallowing an empty indicator?

Probably so that you can declare it as a local without having to
explicitly unset it afterwards.

You can get the effect you want with something like

PROMPT_EOL_MARK='%{%}'

or

PROMPT_EOL_MARK='%<<'

In fact because prompt expansion is applied to PROMPT_EOL_MARK *before*
the precmd functions are called, there are all sorts of interesting side
effects I hadn't previously considered ...


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PROMPT_SP and empty PROMPT_EOL_MARK
  2010-12-05 21:10 PROMPT_SP and empty PROMPT_EOL_MARK Mikael Magnusson
  2010-12-05 21:41 ` Bart Schaefer
@ 2010-12-05 21:50 ` Wayne Davison
  2010-12-06 20:35 ` Greg Klanderman
  2 siblings, 0 replies; 6+ messages in thread
From: Wayne Davison @ 2010-12-05 21:50 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: zsh workers

[-- Attachment #1: Type: text/plain, Size: 424 bytes --]

On Sun, Dec 5, 2010 at 1:10 PM, Mikael Magnusson <mikachu@gmail.com> wrote:

> What is the rationale for disallowing an empty indicator?


I had expected someone to set the char to a space if they didn't want a
visible indicator char.  However, I doubt that it would hurt to allow an
empty string to be used as well, since the C code seems fine at measuring a
zero-width size for an empty PROMPT_EOL_MARK string.

..wayne..

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PROMPT_SP and empty PROMPT_EOL_MARK
  2010-12-05 21:10 PROMPT_SP and empty PROMPT_EOL_MARK Mikael Magnusson
  2010-12-05 21:41 ` Bart Schaefer
  2010-12-05 21:50 ` Wayne Davison
@ 2010-12-06 20:35 ` Greg Klanderman
  2010-12-06 20:44   ` Mikael Magnusson
  2 siblings, 1 reply; 6+ messages in thread
From: Greg Klanderman @ 2010-12-06 20:35 UTC (permalink / raw)
  To: zsh-workers


> What is the rationale for disallowing an empty indicator?

If you don't want it, wouldn't you just turn off PROMPTSP?

greg


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PROMPT_SP and empty PROMPT_EOL_MARK
  2010-12-06 20:35 ` Greg Klanderman
@ 2010-12-06 20:44   ` Mikael Magnusson
  2010-12-06 22:16     ` Greg Klanderman
  0 siblings, 1 reply; 6+ messages in thread
From: Mikael Magnusson @ 2010-12-06 20:44 UTC (permalink / raw)
  To: gak; +Cc: zsh-workers

On 6 December 2010 21:35, Greg Klanderman <gak@klanderman.net> wrote:
>
>> What is the rationale for disallowing an empty indicator?
>
> If you don't want it, wouldn't you just turn off PROMPTSP?

Because that's not what promptsp does?

% echo -n hello
hello
% setopt nopromptsp
% echo -n hello
%
% setopt nopromptcr
% echo -n hello
hello%
(at this point the cursor is on the first l)

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PROMPT_SP and empty PROMPT_EOL_MARK
  2010-12-06 20:44   ` Mikael Magnusson
@ 2010-12-06 22:16     ` Greg Klanderman
  0 siblings, 0 replies; 6+ messages in thread
From: Greg Klanderman @ 2010-12-06 22:16 UTC (permalink / raw)
  To: zsh-workers

>>>>> On December 6, 2010 Mikael Magnusson <mikachu@gmail.com> wrote:

> Because that's not what promptsp does?

Yes, of course, sorry about that.. your proposed change
makes sense, and I see pws has already committed it.
I hadn't really thought about it when I originally
submitted the patch that created PROMPT_EOL_MARK (pws
renamed the parameter if I recall correctly).

Greg


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-12-06 22:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-05 21:10 PROMPT_SP and empty PROMPT_EOL_MARK Mikael Magnusson
2010-12-05 21:41 ` Bart Schaefer
2010-12-05 21:50 ` Wayne Davison
2010-12-06 20:35 ` Greg Klanderman
2010-12-06 20:44   ` Mikael Magnusson
2010-12-06 22:16     ` Greg Klanderman

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).