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

Fix: line longer than terminal width breaks rendering #516

Merged
merged 1 commit into from
Mar 18, 2023

Conversation

tompng
Copy link
Member

@tompng tompng commented Mar 13, 2023

This pull request fixes a bug introduced by #507
When you input long line, longer than the terminal width to irb and type enter, rendering breaks.

# Input data that I added in this pullrequest
def aaaaaaaaaa
  bbbbbbbbbb

# Before
prompt> def aaaaaaaa
prompt> def aaaaaaaa
aa
prompt>   bbbbbbbbbb
prompt>   bbbbbbbbbb
bb
prompt>

# After
prompt> def aaaaaaaa
aa
prompt>   bbbbbbbbbb
bb
prompt>

description

When newline is added to the end of the buffer, reline rerenders last line (because indent might changed) and the added newline.
When the last line is autowrapped (height of last line >= 2), cursor must move up before rerendering the last line, this pull request adds this process.

@st0012
Copy link
Member

st0012 commented Mar 13, 2023

I wonder why test_multiline_and_autowrap didn't catch the issue. Is it because in that test inputs are added in a single writes?

@tompng
Copy link
Member Author

tompng commented Mar 13, 2023

test_multiline_and_autowrap writes at once, and I think writing at once is emulating pasting code.
Reline has in_pasting? check and I think it is making the difference

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.

👍

@ima1zumi ima1zumi merged commit ae5f9b8 into ruby:master Mar 18, 2023
@tompng tompng deleted the fix_longline_newline branch March 18, 2023 15:42
@ima1zumi ima1zumi added the bug Something isn't working label Mar 27, 2023
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.

3 participants