I would like to write a small script in which a user enters a small
pager message. The message can't be longer than 60 characters however,
and instead of informing him after he pressed enter, forcing him to
retype it again or copy and pasting and then editing, is there a way I
could say how many characters are left? Something like:
Enter message (42 chars left): I am the king of the
I would prefer not to use curses if at all possible.
This is really low tech but it might work. do character based input,
and clear the screen and print the prompt plus the keys already
inputted.
You've looked at the highline source, so take a look at how we do cross
platform character reading, and just adapt it to your needs... I'd just
append the entered chars into a String as the user types them.
If you can make this type of prompt into a nice function, please send
it to me because it seems like it might have a place in HighLine.