-
Notifications
You must be signed in to change notification settings - Fork 86
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
Rewrite dialog rendering #492
Conversation
printf "あいうえお\e[7Dかき\n"
printf "あいうえお\e[7Dkaki\n"
printf "aaiiuueeoo\e[7Dかき\n"
# Terminal.app, Terminal in VSCode
あ かき お
あ kaki お
aaiかきeoo
# iTerm2
あ かきお
あ kaki お
aaiかきeoo
# yamatanooroti(vterm 0.3)
あいかきお
あいkakiお
aaiかきeoo To handle this correctly, we should write |
d288fe0
to
9a1cc0c
Compare
I think test_yamatanooroti will be fixed after merging #498 (and rebasing this branch) |
9a1cc0c
to
a4a598d
Compare
I rebased but it still fails test_yamatanooroti. I opend a pull request #502 |
e9e636f
to
db22275
Compare
db22275
to
f9c6dd0
Compare
f9c6dd0
to
b37d971
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unicode change seems relatively independent from the rest. If that's true, can you open a separate PR for it?
b37d971
to
549117a
Compare
549117a
to
2290ce7
Compare
I separated the unicode full-width part to #519 |
e672ae3
to
10e7d64
Compare
10e7d64
to
ec3c334
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested it with IRB a bit and I think it worked great. Thank you for the amazing rewrite 🙏
Just some questions and to check my understanding:
update_each_dialog
method only update dialogs' content, but not writing to the outputrender_dialog_changes
writes changes to the output
Are they correct?
Yes, that's correct |
This is a slow-motion video (with cursor visible) of two algorithms on master branchclear and render by each dialog dialog_before.mp4on this pull requestclear and render by each line from up to down dialog_after.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still can't say that I understand all the computation 😅 But based on the video I think the new approach should be more robust and enables future fixes too. Also didn't find any issue when tested locally, so let's give it a try 👍
(ruby/reline#492) * Rewrite dialog rendering * Fix failing test of dialog with small screen * Add multiple-dialog rendering test * Add description comments for each part of render_dialog_changes
Reline can have multiple dialog in random position as an API design, but failed to render it correctly.
This pull-request will enable rendering multiple dialogs correctly.
Left: before, Right: after
dialogs.mp4
Fixes #489
Fixes #458 in another way.
No more remaining whitespaces. Before this pullrequest, white space remained where dialog exist after dialog closes.
Change dialog rendering
Dialog#contents is now used as an offscreen canvas for each dialog.
Dialogs cannot be clear and re-rendered independently in
render_each_dialog
, especially when they are overlapped.I added
render_dialog_changes
. It can be used in both dialog rendering and dialog clearing.Delete Dialog#lines_backup
Dialog#lines_backup
is not needed. It contains line buffers and base dialog_y coordinate of previous rendering but these are not dialog dependant.Line buffers(
visual_lines
) can be calculated fromwhole_lines()
when we need to restore underlying text.All we need is
@previous_rendered_dialog_y
stored in LineEditor.Handling fullwidth unicode characters
I made a separate pullrequest for it #519
Other
I used this code to capture the movie above