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 completion #622

Closed

Conversation

tompng
Copy link
Member

@tompng tompng commented Dec 28, 2023

(TODO: wait for reline_0.5.0.pre)

Fixes #611 and #621

Split logic and state of autocompletion and tab completion

Before

Reline has tab complete and autocomplete.
Tab complete uses

@completion_state = NORMAL | COMPLETION | MENU | MENU_WITH_PERFECT_MATCH | PERFECT_MATCH

Autocomplete uses

@completion_state = NORMAL | JOURNEY
@completion_journey_data
retrieve_completion_block(not stored to ivar, calling every time, causing dialog disappearing bug)

It's a separate feature but uses same instance variable @completion_state that making hard to fix some bugs.

After

Tab complete uses

@completion_state = NORMAL | COMPLETION | MENU | MENU_WITH_PERFECT_MATCH | PERFECT_MATCH

Autocomplete uses

@completion_journey_state = CompletionJourneyState.new(line_index, pre, target, post, list, pointer) | nil

State is separated. Logic is also separated. Now we can remove redundant proc calls and fix #611 #621

completion_journey_data

completion_journey_data is an API for dialog proc, defined in DialogProcScope. We need to keep compatibility.
It was an instance variable but changed to a method that calculates from @completion_journey_state.

@tompng tompng force-pushed the autocompletion_jouney_refactor branch from 474eb73 to 0e5d4b3 Compare January 4, 2024 17:16
@tompng tompng force-pushed the reline_0.5.0.pre branch 3 times, most recently from 83232d0 to 97d76d8 Compare March 19, 2024 13:12
@ima1zumi ima1zumi deleted the branch ruby:reline_0.5.0.pre March 19, 2024 14:17
@ima1zumi ima1zumi closed this Mar 19, 2024
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