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

nonprinting_start and nonprinting_end should be removed before print #771

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

tompng
Copy link
Member

@tompng tompng commented Oct 23, 2024

Fixes #770

Reline::Unicode.take_range("ABC\1[zero]\2DEFGHIJ", 0, 6)
# => "ABC\u0001[zero]\u0002DEF" (before)
# => "ABC[zero]DEF" (after)

Readline removes \1 and \2. Reline was doing the same until 0.3.2 but broken since 0.3.3

# Readline 8.2
PTY.spawn('ruby', '-e', %q(require 'readline'; Readline.readline "prompt\1[invis]\2>")){|r,w|p r.readpartial(1024)}
#=> "...prompt[invis]>..."

# Reline
PTY.spawn('ruby', '-e', %q(require 'reline'; Reline.readline "prompt\1[invis]\2>")){|r,w|20.times{p s=r.readpartial(1024);w.write "\e[1;1R" if s=~/\[6n/}}
#=> "...prompt\x01[invis]\x02>..." # \x01 and \x02 should be removed

Copy link
Member

@ima1zumi ima1zumi left a comment

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 e364416 into ruby:master Oct 24, 2024
40 checks passed
@tompng tompng deleted the nonprinting_fix branch October 24, 2024 16:37
@ima1zumi ima1zumi added the bug Something isn't working label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

NON_PRINTING_START and NON_PRINTING_END behavior is different from Readline
2 participants