-
Notifications
You must be signed in to change notification settings - Fork 93
LineEditor Re-architecture #595
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6550019 to
590efd0
Compare
590efd0 to
309123c
Compare
309123c to
e92440a
Compare
e92440a to
e861087
Compare
5f62f00 to
1b90d5e
Compare
1b90d5e to
69a3bce
Compare
69a3bce to
37014b8
Compare
This was referenced Dec 1, 2023
Merged
Member
Author
|
Released this change as https://rubygems.org/gems/reline/versions/0.5.0.pre.1 Changes and fix to |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request is a refactor of line_editor.
It also fixes many rendering, cursor position, internal state inconsistency bugs including #581 #575 #520 #491 and more, especially when input lines > screen height.
Problem of LineEditor
What we should do is something like "jQuery to React"
Changes
Single source of truth - Remove duplicated state.
Important state are
@buffer_of_lines@line_index@byte_pointer@scroll_partial_screen@screen_size@cursor_base_y@cursor_base_y + @cursor_yRemoved these because it can be calculated
@line@highest_in_all@highest_in_this@screen_height@cursor@cursor_max@first_line_started_from@started_from@rest_heightRemoved these because it is not a state but something like an action dispatch and a flag for rendering
@previous_line_index@just_cursor_moving@last_key@add_newline_to_end_of_buffer@prev_mode_string@rerender_all@move_up@check_new_auto_indentRemoved these because rendering is improved.
@cached_prompt_list@prompt_cache_time: no need to cache with time anymore.@previous_rendered_dialog_y: not needed anymore because dialog rendering strategy is changed.Render only from state
Don't render, don't move cursor except from single rendering method
render_differential.Lifecycle is simplified
Differential rendering
render_differentialcallsrender_line_differential(old_items, new_items)for each line.Input line and overlay dialogs are abstracted as set of
[x, width, content].