1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

INPUT prompt oddity

Discussion in 'Support' started by Charles Dye, Feb 16, 2009.

  1. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,358
    Likes Received:
    39
    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.
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,040
    Likes Received:
    84
    Charles Dye wrote:

    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
     
  3. dcantor

    Joined:
    May 29, 2008
    Messages:
    508
    Likes Received:
    3
    Work-around: INPUT prompt oddity

    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.
     
  4. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,358
    Likes Received:
    39
    Re: Work-around: INPUT prompt oddity

    Nifty! Thanks.
     
  5. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,040
    Likes Received:
    84
    Re: Work-around: INPUT prompt oddity

    Or you could use ECHOS or SCRPUT.
     
  6. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,358
    Likes Received:
    39
    Re: Work-around: INPUT prompt oddity

    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".
     

Share This Page