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 CommandBuilder, arguments, etc. #979

Merged
merged 29 commits into from
Aug 30, 2024

Commits on Aug 27, 2024

  1. Configuration menu
    Copy the full SHA
    1d9e8ac View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    599c0ed View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    43a81b1 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    076fc15 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    0636872 View commit details
    Browse the repository at this point in the history
  6. Remove count from motion argument

    Only Command has a count. The motion argument is now a sealed class hierarchy, and consists only of the motion action and optional argument. This is to reduce confusion over which count to use, and potential incorrect calculation of the count
    citizenmatt committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    9106517 View commit details
    Browse the repository at this point in the history

Commits on Aug 28, 2024

  1. Simplify CommandBuilder

    Fixes selecting last register if multiple registers are used in a command
    citizenmatt committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    e2a37ce View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7ff6bf9 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6f32a9b View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    98ad763 View commit details
    Browse the repository at this point in the history
  5. Update comment

    citizenmatt committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    868f428 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    37ef432 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    813d16f View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    f6c9392 View commit details
    Browse the repository at this point in the history
  9. Remove KeyHandler.isOperatorPending

    It's easier to just look at mode. We don't need the additional check on command builder, because we can't be in OP_PENDING without pushing an operator action to the command builder
    citizenmatt committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    a8d5ffb View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    d173d50 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    2a9b340 View commit details
    Browse the repository at this point in the history
  12. Deprecate OperatorArguments.isOperatorPending

    Register specific handlers for Operator-pending mode instead of relying on a runtime flag for behaviour. Also refactors and renames some arrow motion handlers.
    citizenmatt committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    f09a7e7 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    8077809 View commit details
    Browse the repository at this point in the history
  14. Remove OperatorArguments.mode usage in block insert

    `OperatorArguments.mode` is the mode *before* the command is completed, so might be Visual, Operator-pending, Insert, etc. It's not immediately obvious this is the case, so we're going to deprecate `OperatorArguments.mode` to avoid confusion with `editor.mode`.
    
    It's not required for this method because it's only called for Visual-block mode.
    citizenmatt committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    4f2dad8 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    04dece7 View commit details
    Browse the repository at this point in the history
  16. Use editor.mode instead of OperatorArguments.mode

    `OperatorArguments.mode` is the mode *before* the command was completed, rather than the current mode, which is non-obvious. E.g. for a command in Insert mode, it will still be Insert, and for a (simple) command in Normal, it will still be Normal. The only difference is that a command such as `dw` would be in Operator-pending before the command is completed. That logic is not required for this method, so it's safe to use the current mode.
    
    This allows us to start to deprecate `OperatorArguments.mode`.
    citizenmatt committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    80ee4e2 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    77ae379 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    9db95e8 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    d6a3e15 View commit details
    Browse the repository at this point in the history
  20. Start to encapsulate setting command builder state

    Also rename `pushCommandPart` and `completeCommandPart`
    citizenmatt committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    6288814 View commit details
    Browse the repository at this point in the history
  21. Reorder CommandBuilder methods

    Try to keep related functions together: awaiting arguments, count, registers, adding action/argument, processing keystrokes, build, reset.
    citizenmatt committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    328cd75 View commit details
    Browse the repository at this point in the history

Commits on Aug 29, 2024

  1. Ensure builder resets to a root command trie node

    Also refactors command nodes a bit for better debug/trace output
    citizenmatt committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    7c4a2ca View commit details
    Browse the repository at this point in the history
  2. Encapsulate the command builder's state flag

    This also gets rid of BAD_COMMAND, which was set but never checked - the function that set the flag would immediately reset the command builder
    citizenmatt committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    06ff832 View commit details
    Browse the repository at this point in the history