-
Notifications
You must be signed in to change notification settings - Fork 822
Refactor edit commands and create readline for vi mode #1885
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
base: main
Are you sure you want to change the base?
Conversation
I haven't noticed any issues with this while dogfooding it for the last two weeks, including both inside and outside of terminal, so it looks like I haven't broken the regular commands either. |
core/edit/edit_command_actions.py
Outdated
""" | ||
action_type = action.type | ||
|
||
if action_type in simple_action_callbacks: |
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.
This if statements means that you can't add more callbacks to a context implementation of get_simple_action_callback()
.
get_simple_action_callback()
could return None to indicate that there is no simple action call back for this action type.
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.
That's a good catch, I have altered it. I don't think there is any way to call the original mod action function once you have created a context override, correct? So while your modification would let someone entirely replace the callbacks, it would not let them extend it. Any ideas for how to do this? It will actually have an immediate benefit, because I will be able to map ctrl+w to clear word left, which will be faster and cleaner than the current implementation of having to press escape
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.
You can call actions.next()
to call that next most specific implementation.
Required reworking of the edit command system somewhat to make it more flexible and overridable
for more information, see https://pre-commit.ci
Co-authored-by: Andreas Arvidsson <andreas.arvidsson87@gmail.com>
Generally speaking the refactor allows you to override how edit actions are applied, which I uses to make sure that the modifier/selection applies by creating a vim motion instead of trying to select terminal text. The refactors to the edit commands are fairly minimal, it's just converting the functions into user actions and refactoring out actions to access the internal dictionaries.
In draft mode while I dog food it for a week or so to ensure it is ready, But reviews are welcome anyway