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

simplify handling of input escape codes & support ctrl+arrows #216

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dzwdz
Copy link

@dzwdz dzwdz commented Aug 10, 2023

ESC [ codes always end with a char in 0x40-0x7E. Using that lets me (subjectively) simplify the handling of longer escape codes and prevent unrecognized codes from being handled as user input.

Also, since this makes adding support for new escape codes easier, I took the chance to implement Ctrl+arrows for moving between words ala readline.

this:
1. prevents unknown escape sequences from leaking over as real input in some
situations
2. makes it easier to handle longer escape sequences in the future
yhirose's patch didn't make linenoiseEditDeletePrevWord() use the encoding
abstractions, so i'm being consistent here. it works with utf8 anyways

furthermore, this makes it easier to cherrypick this onto a separate branch
and send as a PR upstream
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.

None yet

1 participant