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

Unite key bindings, key mapping and multibyte buffer #708

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tompng
Copy link
Member

@tompng tompng commented May 26, 2024

What is this?

KeyActor, key_bindings(key_stroke.rb) and multibyte_buffer(LineEditor) can be united. This will reduce complexity.
This pull request is a goal of this refactor. I'm planning to open several separate pull requests.

What can be solved?

  • LineEditor does not need to handle 3 types of input: part of multibyte character, symbol key, ascii byte assigned to a method.
  • Complex read_2nd_character_of_key_sequence can be removed.
  • Reline can't correctly handle conflicting key binding specified in inputrc now. It can be fixed.

What to do

  • Improve KeyStroke
    • Matching algorithm needs to be faster because the total entry will increase (default_key_bindings(size=25) → key_bindings + key_mappings(size=256))
    • Should have three state(:matching | :matched | :matching_matched) but the last one is missing now
    • Delete ESC-specific read_2nd_character_of_key_sequence and implement generic one
  • Move multibyte_buffer from LineEditor to key recognizing layer
  • Simplify Reline::Key structure, no mixing symbol and integer

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.

1 participant