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

Refactor handling key in LineEditor #799

Merged
merged 1 commit into from
Jan 3, 2025

Conversation

tompng
Copy link
Member

@tompng tompng commented Jan 1, 2025

Simplify the complicated flow of waiting_proc, wrap_method_call and run_for_operation.

  1. Block passed to run_for_operators was always the same. Change to just simply call wrap_method_call.
  2. Stop passing method_obj to another method.
  3. wrap_method_call now handles waiting_proc (to reduce duplicated code)
  4. Reduce duplicated code in process_key
  5. Reduce duplicated code that handles @vi_waiting_operator in process_key and in run_for_operators
  6. Use __send__ instead of wrap_method_call(@vi_waiting_operator, ...) because @vi_waiting_operator is not a key-bounded method.
  7. Stop calling ed_argument_digit in specific condition. Instead, implement vi_zero and ed_digit correctly.

Simplify the complicated flow of waiting_proc, wrap_method_call and run_for_operation
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 72c0ec0 into ruby:master Jan 3, 2025
45 checks passed
matzbot pushed a commit to ruby/ruby that referenced this pull request Jan 3, 2025
(ruby/reline#799)

Simplify the complicated flow of waiting_proc, wrap_method_call and run_for_operation

ruby/reline@72c0ec0425
@tompng tompng deleted the refactor_key_method_call branch January 4, 2025 09:36
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