-
Notifications
You must be signed in to change notification settings - Fork 93
Refactor perform_completon #778
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -670,6 +670,19 @@ def self.vi_backward_word(line, byte_pointer) | |
| [byte_size, width] | ||
| end | ||
|
|
||
| def self.common_prefix(list, ignore_case: false) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious, what's the purpose of this method?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Calculates the common prefix of the list
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand. Thank you! |
||
| return '' if list.empty? | ||
|
|
||
| common_prefix_gcs = list.first.grapheme_clusters | ||
| list.each do |item| | ||
| gcs = item.grapheme_clusters | ||
| common_prefix_gcs = common_prefix_gcs.take_while.with_index do |gc, i| | ||
| ignore_case ? gc.casecmp?(gcs[i]) : gc == gcs[i] | ||
| end | ||
| end | ||
| common_prefix_gcs.join | ||
| end | ||
|
|
||
| def self.vi_first_print(line) | ||
| width = 0 | ||
| byte_size = 0 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the test still failing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. here's the failed ci log https://github.com/tompng/reline/actions/runs/11743521493/job/32716559834