rndusr / stig

TUI and CLI for the BitTorrent client Transmission
GNU General Public License v3.0
556 stars 24 forks source link

Add control-arrow for jumping whole words in the command mode #167

Closed Soundtoxin closed 4 years ago

Soundtoxin commented 4 years ago

When adding a torrent, sometimes I put :add /path/to/the directory and then I realize I need to go back and quote it because of the space, so I hit ctrl-left arrow and it does nothing. I did try emacs/readline keybinds and find that M-b goes back a word, so that's good. Could the ctrl-arrow key binds be added as well? I think they're part of the CUA standard. They work in stuff like web browsers and irc clients, so a lot of people are probably used to them.

lenormf commented 4 years ago

and then I realize I need to go back

Reason why I made #162 :) Referencing it here.

Soundtoxin commented 4 years ago

In my case I don't need to go to the very ends, otherwise home/end keys or C-a and C-e work fine. Also, I'm talking about mid-typing before I hit enter in my case, not sure if that was clear.

rndusr commented 4 years ago

Tab completion should automatically quote any arguments that need quoting.

You can bind keys to other keys, so "bind " should work.

Unfortunately, it's a little more complicated, but this seems to work:

stig -C unbind --context main '<alt-b>' and bind '<ctrl-left>' '<alt-b>'

urxvt doesn't seem to be able to catch at all.

Soundtoxin commented 4 years ago

I'm having some troubles with that. If I put the unbind thing in my rc file, it refuses to start with this error

unbind: Key not mapped in context 'main': <alt-f>

and if I just use these lines:

bind <ctrl-left> <alt-b>  
bind <ctrl-right> <alt-f> 

then ctrl-right works the same as alt-f, but ctrl-left seems to show/hide the bar at the bottom showing free space and number of torrents.

I was able to do the unbind command for ctrl-left after starting, though. Is it that ctrl-left or alt-b does something that is interfered with, but ctrl-right/alt-f doesn't? I guess I now noticed the error was just about alt-f not being mapped in context main even though I had unbind lines for both in my rc file.

Soundtoxin commented 4 years ago

Okay, I was rushing too much. I've now mapped both ctrl-left and ctrl-right and done the unbind in context main only for ctrl-left and all seems to be well now, works in the rc file and everything. I didn't know about the advanced key binding feature before this. I guess I can consider this solved. Thanks for the help.

rndusr commented 4 years ago

Yeah, sorry, I should've explained that more.

Alt-b is mapped by default to hide the bottom bar. There's a bug that gives the "main" context precedence over the CLI. That's why ctrl-left hides the bottom bar unless you unbind alt-b first.