Search code examples
rubyhighline

Highline ask method won't use same line


Setup:

  • Bash
  • Ruby 1.9.2
  • highline (1.6.13)

Description:

I'm fairly used to highline with some other projects, but haven't used it in a few months. Now, on a fresh install on Ruby 1.9.2, it doesn't seem to allow prompts to be answered on the same line.

So previously I would see something like:

 require "highline/import"
 ask "What is your favorite color?"

And get:

 What is your favorite color? |

Now I see something like:

 What is your favorite color?
 |

Where the pipe (|) symbol is my terminal cursor.

Any ideas why this change has occurred?


Solution

  • Put a space at the end of the question string, eg

    ask "What is your favorite color? "