Repository navigation
append completion_append_character only when continous completion is … - #764
Conversation
| end | ||
| return if result.nil? | ||
| target, preposing, completed, postposing = result | ||
| target, preposing, completed, postposing, continuable = result |
There was a problem hiding this comment.
continuable in calculated twice.
One in complete_internal_proc(list.count > 1) and other in this method
if list.one?
@completion_state = CompletionState::PERFECT_MATCHHow about using the condition @completion_state != CompletionState::PERFECT_MATCH instead of continuable, or set a local variable inside if list.one?
if list.one?
@completion_state = CompletionState::PERFECT_MATCH
perfect_matched_and_need_to_perform_append_char = true # FIXME: shorter name
endThere was a problem hiding this comment.
Thanks for your suggestion! But consider this case when list is something like:
['foo', 'foo_bar']
When we input foo_[tab], it will be completed to foo_bar. A completion char should be appended but currently this case will be marked as MENU_WITH_PERFECT_MATCH. That's why I separately check list.count instead of inside if list.one? case.
After reconsideration, I think maybe it's OK to treat the above case as a PERFECT_MATCH?
(For demonstration I made the changes anyway. Looking forward to you comment! )
There was a problem hiding this comment.
Treating it as PERFECT_MATCH makes sense to me 👍
| @buffer_of_lines[@line_index] = (preposing + completed + completion_append_character.to_s + postposing).split("\n")[@line_index] || String.new(encoding: @encoding) | ||
| line_to_pointer = (preposing + completed + completion_append_character.to_s).split("\n")[@line_index] || String.new(encoding: @encoding) | ||
| unless just_show_list | ||
| _completion_append_character = continuable ? '' : completion_append_character.to_s |
There was a problem hiding this comment.
Underscore prefixed local variable represents unused variable. Ruby itself won't show unused variable warning if the unused variable starts with _. If it is used, it is better not start with _.
How about just append_character or completed += completion_append_character.to_s unless continuable
|
The change looks good. Could you resolve conflicts? |
Fix #754. Insert
completion_append_characteronly when there is no more possible completion