Skip to content

nonprinting_start and nonprinting_end should be removed before print - #771

Merged
ima1zumi merged 1 commit into
ruby:masterfrom
tompng:nonprinting_fix
Oct 24, 2024
Merged

ima1zumi merged 1 commit into
ruby:masterfrom
tompng:nonprinting_fix

Conversation

@tompng

@tompng tompng commented Oct 23, 2024

Copy link
Copy Markdown
Member

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

@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 e364416 into ruby:master Oct 24, 2024
@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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NON_PRINTING_START and NON_PRINTING_END behavior is different from Readline

2 participants