Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

INPUT prompt oddity

Charles Dye

Super Moderator
May
4,938
126
Staff member
INPUT trims any leading spaces from the specified prompt string if any switch is present. If no switch is used, leading spaces are preserved. So, for example,

Code:
input `      Prompt: ` %%var
displays the prompt indented six spaces, but

Code:
input /e `      Prompt: ` %%var
does not indent the prompt.
 
Charles Dye wrote:

> INPUT trims any leading spaces from the specified prompt string if any switch is present. If no switch is used, leading spaces are preserved. So, for example,
>
>
> Code:
> ---------
> input ` Prompt: ` %%var
> ---------
> displays the prompt indented six spaces, but
>
>
> Code:
> ---------
> input /e ` Prompt: ` %%var
> ---------
> does not indent the prompt.

WAD - the back quotes are removed by the parser before the internal
command is called, and when an internal command calls the switch parser,
the switch and all of the following whitespace is removed. (This
behavior goes back to 2.0.)

Rex Conn
JP Software
 
Work-around: INPUT prompt oddity

INPUT trims any leading spaces from the specified prompt string if any switch is present. If no switch is used, leading spaces are preserved. So, for example,

Code:
input `      Prompt: ` %%var
displays the prompt indented six spaces, but

Code:
input /e `      Prompt: ` %%var
does not indent the prompt.

I found that inserting an escaped-form backspace will give you the affect you want:

Code:
input /e `^b     Prompt: ` %%var
does indent using the number of spaces between the 'b' and the 'P'. The actual backspace output doesn't do anything at the beginning of a line.
 
Re: Work-around: INPUT prompt oddity

Or you could use ECHOS or SCRPUT.

That's what I've been doing, rolled in a trivial alias to indent the desired number of spaces. Really, this is just a slightly surprising (to me) behavior, rather than a problem -- an "oddity", not an "issue".
 

Similar threads

G
Replies
2
Views
3K
Back
Top