Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newline not honored in Reline.readline("\nMy Prompt: ") #636

Open
MadBomber opened this issue Jan 13, 2024 · 2 comments
Open

newline not honored in Reline.readline("\nMy Prompt: ") #636

MadBomber opened this issue Jan 13, 2024 · 2 comments

Comments

@MadBomber
Copy link

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

@fractaledmind
Copy link

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

@ddoherty03
Copy link

ddoherty03 commented Nov 4, 2024

I see a similar issue with a multi-line prompt:

I set prompt to:

Adapter: postgresql
byr:4.55.1:home:dev>

but it gets rendered as:

Adapter: postgresql
Adapter: postgresql\nbyr:4.55.1:home:dev>

Readline handles this properly.

Using konsole.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants