Skip to content

Conversation

@albinekb
Copy link
Contributor

This adds support for moving left/right in the message editor, also supports alt+left|right to move between words.

termion added support for AltLeft & AltRight but it was removed before it was released, don't know what happened there... https://gitlab.redox-os.org/redox-os/termion/-/commit/d96c13560c2600fdb5100ff67ae98d65bf12c56c

I made a workaround by setting is_control_input and then handling the escaped character, maybe there's a better way 🤔

@LinusU
Copy link
Owner

LinusU commented Dec 28, 2022

This looks really nice!

I've created an account at their GitLab server to ask about it, waiting for the account to get approved

@albinekb
Copy link
Contributor Author

albinekb commented Jan 2, 2023

I tested the commit that added AltLeft and AltRight, it didn't seem to work
I also tested crossterm, they have solved it with terminal integrations, so only works in some places: https://docs.rs/crossterm/latest/crossterm/event/struct.PushKeyboardEnhancementFlags.html

I think the hack is fine for now :D I have used it and it works as expected

@cstruct
Copy link
Contributor

cstruct commented Jan 5, 2023

I'd much prefer if a proper line editor like rustyline was used.

@albinekb
Copy link
Contributor Author

I tried out using rustyline, but could not find any way to render/get the current input value that we need to display the commit rules and if they pass/didnt pass.

There's no way to get the current input value for validation and the rendering will be more complicated than this simple line editor.

I also tested https://github.com/sayanarijit/tui-input with termion, but that has another issue that it only supports "fixed" layout, eg. it wants alternate screen mode and draw the prompt/UI with fixed coordinates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants