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

Separate prompt and input line in rendering #652

Merged
merged 2 commits into from
Apr 23, 2024

Conversation

tompng
Copy link
Member

@tompng tompng commented Mar 19, 2024

Split prompt and input_line passed to render_line_differential.
This will improve differential rendering performance in these cases

  • prompt changed but input_line is not changed
  • input_line changed but prompt is not changed

To separately render prompt and input_line, line items passed to render_line_differential is changed

# before
[[0, 12, "prompt> code"], [13, 7, "Dialog1"]]
# after
[[0, 8, "prompt> "], [8, 4, "code"], [13, 7, "Dialog1"]]

@tompng tompng force-pushed the split_prompt_line_render branch 2 times, most recently from ddca9a3 to c2d49e1 Compare March 26, 2024 02:30
Often, only one of prompt and input changes.
Split prompt+input_line to a separate rendering item will improve differential rendering performance.
@@ -366,7 +366,7 @@ def screen_scroll_top
@scroll_partial_screen
end

def wrapped_lines
def wrapped_prompt_lines
Copy link
Member

@ima1zumi ima1zumi Apr 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about naming it wrapped_prompt_and_lines or wrapped_prompt_and_input_lines? This would make it clear that prompts and lines are returned separately.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrapped_prompt_and_input_lines looks good, thanks!
updated

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.

LGTM 🌟

@ima1zumi ima1zumi merged commit 16d82f1 into ruby:master Apr 23, 2024
40 checks passed
matzbot pushed a commit to ruby/ruby that referenced this pull request Apr 23, 2024
(ruby/reline#652)

* Separate prompt and input line in rendering

Often, only one of prompt and input changes.
Split prompt+input_line to a separate rendering item will improve differential rendering performance.

* Rename method wrapped_prompt_lines to more descriptive name

ruby/reline@16d82f1f23
@tompng tompng deleted the split_prompt_line_render branch April 23, 2024 15:04
artur-intech pushed a commit to artur-intech/ruby that referenced this pull request Apr 26, 2024
(ruby/reline#652)

* Separate prompt and input line in rendering

Often, only one of prompt and input changes.
Split prompt+input_line to a separate rendering item will improve differential rendering performance.

* Rename method wrapped_prompt_lines to more descriptive name

ruby/reline@16d82f1f23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants