Skip to content

Don't print useless prompt before escape sequence#839

Merged
ima1zumi merged 1 commit into
ruby:masterfrom
tompng:no_useless_prompt_print
Jul 15, 2025
Merged

Don't print useless prompt before escape sequence#839
ima1zumi merged 1 commit into
ruby:masterfrom
tompng:no_useless_prompt_print

Conversation

@tompng

@tompng tompng commented Jul 8, 2025

Copy link
Copy Markdown
Member

Fixes #833

Reline used to print prompt in nomultiline mode before printing any escape sequence because readline-ext's test was requiring.
It's completely useless because printed prompt will be cleared immediately.
This behavior causes line-wrapped long prompt displayed twice.

Before:

Reline.readline 'prompt'+'>'*50
prompt>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
prompt>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>> Prompt displayed twice

After:

Reline.readline 'prompt'+'>'*50
prompt>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>> OK

Side effect

Test code that depend on this behavior needs to be modified.

  • rubygems/rubygems: two test fails
    • bundler/spec/commands/info_spec.rb
    • bundler/spec/commands/show_spec.rb
  • ruby/debug
    • console_test seems to pass
  • ruby/rdoc
    • ri test seems to pass

Reline used to print prompt in nomultiline mode before printing any escape sequence because readline-ext's test was requiring.
Removing this behavior because it causes line-wrapped long prompt displayed twice.
Test code that depend on this behavior needs to be modified.
@deivid-rodriguez

Copy link
Copy Markdown

Thank you for fixing this!

I did find that line as suspicious and tried removing it, but saw one failing test and decided to not dig further and report the problem instead 😅

I'll gladly update Bundler specs to match correct behavior 👍.

@tompng tompng requested a review from ima1zumi July 12, 2025 16:43

@ima1zumi ima1zumi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ima1zumi ima1zumi merged commit 5a0d2c0 into ruby:master Jul 15, 2025
44 checks passed
@tompng tompng deleted the no_useless_prompt_print branch July 15, 2025 16:40
@ima1zumi ima1zumi added the bug Something isn't working label Jul 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

First line of prompt is displayed twice when bigger than screen width

3 participants