INPUT prompt oddity

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,496
91
Albuquerque, NM
prospero.unm.edu
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
12,406
152
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
571
4
Groton, CT
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.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,496
91
Albuquerque, NM
prospero.unm.edu
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
Thread starter Title Forum Replies Date
S INPUT fails if the entered text contains pair of square brackets Support 6
Joe Caverly Command Input Syntax Colouring Support 3
T Disable audible beep on input and inkey Support 2
T input accepts empty answer Support 5
WinLanEm INPUT problem Support 1
rps Command Input Window tab completion broken Support 7
D Documentation Using "send all input to other tabs" Support 11
J Input text converts to uppercase Support 1
B Select and run lines from Command Input panel? Support 1
Charles Dye TYPE /P behaves strangely with piped/redirected input Support 0
T command input font Support 2
ehab aboudaya How to? Command Input history for each tab? Support 0
M How to? How do I read a Unicode file through standard-input? Support 4
Joe Caverly How to? Function Key With INPUT Support 5
E Saving out Command Input window Support 4
J VIEW crash on redirected input and numbered bookmarks Support 6
J Keyboard input error Support 6
vefatica TCMD tabs and input focus Support 11
daniel347x Is it possible to send a line from the "command input" window to the tab without pressing "Enter", w Support 4
Stefano Piccardi how to @SELECT redirected input? Support 4
A GNU ed won't accept redirected input Support 0
G Command Input window Support 2
dcantor Suggestion for @DATE[] input Support 2
J Command line completion in the "Command Input" Window Support 3
E Environment variables, set and input Support 2
vefatica ANSI, PROMPT ... ??? Support 1
FreezerBurnt ANSI Prompt messes up list output. Support 39
FreezerBurnt "Missing SETLOCAL" when initializing Visual Studio Command Prompt. Support 9
M How to? Black TCC Prompt Support 2
N Command execution slows down in TCC Prompt after a while Support 6
K Fixed Prompt display will be shifted after use dir to display a filename with Chinese. (v25.00.28 x64) Support 18
vefatica Timing commands with $= in the prompt? Support 16
samintz How to? Alias or prompt? Support 1
T Elapsed time format in prompt changed in TCC 25 Support 10
samintz MOVE and Prompt on overwrite Support 3
robinsiebler Creating a custom prompt Support 9
K TCC prompt background color Support 4
Alpengreis Problem if command prompt is not legacy Support 4
Joe Caverly Documentation Customizing the TCC Prompt Support 0
C How to? handle the UAC prompt on computer restarts with Everything Support 3
B when doing SFTP via IFTP to my secure site my users always get the finger print key prompt Support 1
M PROMPT with git branch Support 1
MikeBaas How to? SELECT: exclude files / display prompt Support 2
vefatica ? "prompt" command Support 3
S Elapsed time in TCC prompt question Support 0
Joe Caverly Determine if program started from command prompt Support 2
W Opening a new tab takes forever to get the command prompt Support 5
vefatica UAC prompt? Support 0
C How to? ctrl-c does not prompt "Terminate batch job" Support 2
Mordachai TCMD Prompt Here?!@ Support 14

Similar threads