Skip to content

Refactor nomultiline and multiline mode difference - #653

Merged
tompng merged 2 commits into
ruby:masterfrom
tompng:simplify_nomultiline_node
Apr 17, 2024
Merged

tompng merged 2 commits into
ruby:masterfrom
tompng:simplify_nomultiline_node

Conversation

@tompng

@tompng tompng commented Mar 19, 2024 •

Copy link
Copy Markdown
Member

We don't need so much if-else branch for multiline mode and nomultiline mode.

This will internally allow multiline input in nomultiline mode. (#641)
Supporting multiline in nomultiline is needed to implement bracketed paste, pasting multiline text into nomultiline mode.

To manually test multiline input in singleline mode

Input multiline input to IRB, to append multiline history

irb(main):001* if 1
irb(main):002*   2
irb(main):003> end

Toggle singleline mode by calling Reline.readline '>> '

irb(main):004> Reline.readline '>> '
>> 

Press up arrow

>> if 1
  2
end

You can try this reproduction step in an older version of Reline, and can see a bug like this

irb(main):004> if 1          █

@tompng
tompng force-pushed the simplify_nomultiline_node branch from 8459ca5 to ea9e69c Compare March 25, 2024 13:42
@tompng
tompng marked this pull request as ready for review March 25, 2024 13:55
@ima1zumi ima1zumi added the enhancement New feature or request label Apr 11, 2024
@tompng
tompng force-pushed the simplify_nomultiline_node branch from ea9e69c to 990b7c8 Compare April 16, 2024 15:21
Comment thread lib/reline/line_editor.rb Resolved
@tompng
tompng merged commit 9784609 into ruby:master Apr 17, 2024
@tompng
tompng deleted the simplify_nomultiline_node branch April 17, 2024 16:12
matzbot pushed a commit to ruby/ruby that referenced this pull request Apr 17, 2024
(ruby/reline#653)

* Support multiline input in Reline.readline internally, reduce multiline-singleline branch

* Add readline(singleline) prompt test with force inserting multiline text

ruby/reline@97846095d7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants