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

Support menu-complete-backward command for upward navigation #677

Merged
merged 1 commit into from
Apr 14, 2024

Commits on Apr 13, 2024

  1. Support menu-complete-backward command for upward navigation

    Fixes ruby#675
    
    This commit extracts the upward navigation condition in `LineEditor#input_key` to a new private method, and adds a new alias. This change allows Reline to support upward navigation in when a user has configured `inputrc` to map Shift-Tab to `menu-complete-backward`, a common setting in Bash (>= 4.x).
    
    Instead of special-casing upward navigation in `LineEditor#input_key`, we now allow it to be processed by the branch that calls `process_key`. The extracted method no longer includes the editing mode check since this check is already made by `#wrap_method_call` by the time `#completion_journey_up` (or `#menu_complete_backward`) is called. Since upward navigation is happening in a method other than `#input_key` now, the `completion_occurs` variable that used to be local to `#input_key` is changed to an instance variable so that the new method can change its value. (I see many examples of mutating such instance variables in `LineEditor`, so I assumed this would be an uncontroversial change consistent with the coding practices already in place.)
    
    Test coverage of this change has been added to the emacs and vi `KeyActor` tests.
    
    Many thanks to @ima1zumi for their very helpful comments on ruby#675 which encouraged me to contribute this work!
    mjgiarlo committed Apr 13, 2024
    Configuration menu
    Copy the full SHA
    28b5629 View commit details
    Browse the repository at this point in the history