NomadNet icon indicating copy to clipboard operation
NomadNet copied to clipboard

add ctrl-w/ctrl-a/ctrl-e readline shortcuts for message editing, moving close to ctrl-q

Open neutralinsomniac opened this issue 5 months ago • 6 comments

After inadvertently closing my chat window for the 100th time when trying to use ctrl-w to delete a word, I decided to implement this change. I'd love to have ctrl-u (delete from cursor pos to beginning) and ctrl-k (delete from cursor position to end) behave the same as readline as well, but figured you'd want to have a say in the potential remap of ctrl-u (purge) before that could maybe happen.

neutralinsomniac avatar Jan 24 '24 19:01 neutralinsomniac

If you want to look at my proposed ctrl-u/ctrl-k additions as well, I have them sitting on top of this commit here: https://github.com/neutralinsomniac/NomadNet/tree/more_readline_keys

neutralinsomniac avatar Jan 25 '24 15:01 neutralinsomniac

I think these do make sense, and I'm open to also doing the other remaps you mention, but I have seen some problems with Ctrl-Q and Ctrl-S, since they're used for XON/XOFF by default, and in some situations will be captured directly by the terminal (and not sent to the application), even though the application is running in interactive mode. So Ctrl-Q for an essential function may not be the best idea.

If you can come up with a meaningful mapping that accommodates everything, that'd be a welcome improvement.

markqvist avatar Feb 08 '24 16:02 markqvist

So I hear what you're saying about ctrl-S and ctrl-Q, but we already use ctrl-S for saving nodes on the network pane presumably without issue (I haven't run into any issues with that shortcut in the 5 or so terminals I've thrown at it so far at least).

neutralinsomniac avatar Feb 09 '24 01:02 neutralinsomniac

Just messed around with it a bit, and it seems to easily fail working over ssh (and rnsh), where there may be mismatches between terminfo/termcap databases.

markqvist avatar Feb 09 '24 14:02 markqvist

Does that mean we should remap the existing ctrl-s shortcut too then? That's gonna be a tough one to think of a replacement for haha

neutralinsomniac avatar Feb 09 '24 14:02 neutralinsomniac

Heh, yeah, won't really be intuitive. But the Ctrl-S shortcuts have an alternative mapped too, in case it's intercepted for XOFF (Ctrl-B for saving a node). At the very least, there needs to be an alternative for closing the window.

Or maybe it could just be a configuration option to use Ctrl-W for word delete instead of window close. I actually think this might be the best solution. Would you be up for doing it like that?

markqvist avatar Feb 09 '24 14:02 markqvist