newline not honored in Reline.readline("\nMy Prompt: ")
MadBomber opened this issue · comments
Dewayne VanHoozer commented
Description
When I start my prompt with "\n" I am expecting that character to start a new line not to be printed to the terminal as two characters "" and "n" in front of my prompt text
$ ruby temp.rb
\nMy Prompt: hello world
hello world
$ cat temp.rb
require 'reline'
answer = Reline.readline("\nMy Prompt: ")
puts answer
Ruby version 3.3.0
Terminal Emulator
iTerm2
Stephen Margheim commented
I was bumping into the same issue. I worked around it like so:
*initial_prompt_lines, last_prompt_line = prompt_lines
puts initial_prompt_lines.join("\n") if initial_prompt_lines.any?
response = Reline.readline(last_prompt_line, history = false).chomp