INPUT prompt oddity

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,643
46
Albuquerque, NM
prospero.unm.edu
#1
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.
 

rconn

Administrator
Staff member
May 14, 2008
10,607
97
#2
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
 
May 29, 2008
533
3
Groton, CT
#3
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.