PrettyPrompt
PrettyPrompt copied to clipboard
Custom keybindings for caret movement
I haven't found a way to change the keybinds for caret movement and other things like that, and it would be nice to be able to be able to change them to emacs-style. I know there is a GetKeyPressCallbacks
function, but it doesn't seem to allow you to set the caret position.
Keybindings for caret movement are not currently configurable. See: KeyBindings.cs
Should it be used also for text selection (same as e.g. Shift+RightArrow)?
Hm well I guess it would probably be good to be able to customise as many keybinds as possible.
On my local copy of the code, I did some experimentation and made KeyPressCallbackAsync
take a class that communicates with Document
under the hood, in order to then be able to set the caret position and some other things from a key press callback. I also made user-assigned key binds set key.Handled
to true while also evaluating before the hard-coded ones, to allow for users to overwrite the hard-coded key binds. I'm not familiar enough with the code to know the best way to do this myself though.
The correct way to do this is to extend KeyBindings.cs and use the new keyBinding at all places where Arrow keys are now explicitly used in PrettyPrompt code. At each place, one has to decide whether to use the new 'moveKeyBindings' or not instead of Arrow keys.