Repository navigation
Refactor perform_completon - #778
Conversation
d45c432 to
0a1e254
Compare
Flatten recursive method Remove CompletionState::COMPLETE
0a1e254 to
3a74d9b
Compare
|
|
||
| unless Encoding.compatible?(target.encoding, item.encoding) | ||
| # Crash with Encoding::CompatibilityError is required by readline-ext/test/readline/test_readline.rb | ||
| # TODO: fix the test |
There was a problem hiding this comment.
Yes. here's the failed ci log https://github.com/tompng/reline/actions/runs/11743521493/job/32716559834
| [byte_size, width] | ||
| end | ||
|
|
||
| def self.common_prefix(list, ignore_case: false) |
There was a problem hiding this comment.
Just curious, what's the purpose of this method?
There was a problem hiding this comment.
Calculates the common prefix of the list
common_prefix(["a.singleton_class", "a.singleton_method", "a.singleton_methods"]) returns
the common part prefix "a.singleton_"
Used in TAB completion
$ irb --noautocomplete
irb(main):001> a=''
=> ""
irb(main):002> a.sin[TAB]
↓
irb(main):002> a.singleton_
complete_internal_proc was doing this common prefix calculation (and also doing other things like filtering list and menu setup)
I split it to common_prefix (Pure string processing logic independent to line_editor) and filter_normalize_candidates (including completion logic).
(ruby/reline#778) Flatten recursive method Remove CompletionState::COMPLETE ruby/reline@aa5b278f3d
LineEditor#perform_completionwas complicated.When autocomplete is off, state is NORMAL, show_all_if_ambiguous is set, input is
1.ab[TAB]It turned out that CompletionState::COMPLETION was not needed at all.
This pull request simplifies the flow.
Fixes tab completion with completion-ignore-case.
Unintentionally fixes bug related to the complex flow. Typing
1.ab[TAB][DELETE_CHAR_OR_LIST]wrongly triggered show_document.