-
Notifications
You must be signed in to change notification settings - Fork 675
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
Make ctrl left and right #131
Comments
A: This is not a typical movement command in POSIX / UNIX. Linenoise is 100% POSIX. However, it would be easy to add this to your own copy of linenoise. A lot of people that use linenoise hack it for one reason or another. It is very easy to understand and mod. Here is a chart that compares control key usage on Win/Unix/Emacs: https://en.wikipedia.org/wiki/Control_key What to do? on line # 41 in linenoise.c you will find a discussion of how the cursor is controlled. On line # 768 you will find If you were to change editing functionality it would be here in this function. Also remember that multi-line editing must be turned on with the API call: linenoiseSetMultiLine(1);I hope this helps and Happy Thanksgiving! (no matter where you are :-) |
Is this referring to the same idea as #64 and #92, or something else? I don't think linenoise restricts itself to line editing features defined by POSIX (and I couldn't even find a source of specific escape sequences that POSIX defines, although I found a lot of information on vi/emacs/readline back-word and forward-word sequences). You might be thinking of the fact that linenoise relies on a POSIX environment, but that only means it has to stay away from OS-specific calls. |
Maybe I was unclear - I'm aware that control+left doesn't correspond to a control character (in the way that ctrl+a corresponds to \01, etc.). A lot of terminal emulators produce a different escape sequence for this, though (like If you've found something that lists which line editing escape sequences POSIX does(n't) define, or something that states that linenoise won't implement any that aren't part of the POSIX standard, please do let me know, as I've been unable to find it. Edit: if you're referring to the table you linked above, although that isn't referring to POSIX, I think I see your point. I'm not arguing in favor of ctrl+left/right specifically, though, but I don't think some sequence is a bad idea. Also, that isn't a complete list of key combinations or readline bindings - I believe readline binds esc-b/f (and possibly other, longer escape sequences) to back/forward-word by default, which aren't listed there. |
I think the feature JelteF wants involves extending the input escape sequences linenoise handles (here, e.g. the sequences generated by pressing arrow keys or delete), and you're referring to output escape sequences (e.g. sequences sent to output to actually move the cursor). I do agree that dealing with termcap is beyond the scope of linenoise, and I appreciate the fact that linenoise is implemented with as few commands as it is. |
Perhaps @JelteF could clarify what exactly this feature request is asking for. I thought it was about handling two extra sequences in linenoiseEdit(), but I could be wrong. |
Just fyi, if it's about moving one word left/right when |
@c-cube is right that tha's what I meant. Sorry for not responding earlier. |
haha, its only been a year and a half, thats nothing in internet time. And right there in linenoiseEdit() too. Thanks @c-cube 👍 |
These keyboard shortcuts are super useful when navigating an already existing line quickly. Is there any reason why they are not implemented?
The text was updated successfully, but these errors were encountered: