rndusr / stig

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

Move command (tm) shows directory of highlighted torrent in prompt instead of marked torrent(s) #192

Open Soundtoxin opened 3 years ago

Soundtoxin commented 3 years ago

First let me explain what leads to this issue. I have 4 adjacent torrents I added in a stopped state. I want to move them all from the default directory to a different one, but the same different one. So I start at the top torrent and press space 4 times. As you know, it moves the cursor down after selection. So then if I press tm, I'm actually on a 5th torrent that I did not mark, and it tries to move that one instead of the four I have just marked. So, in practice I have to do space-space-space-space-k-tm to make sure I'm on one of the marked torrents instead of just space-space-space-space-tm to execute the move from anywhere. This behavior is undesirable to me. I'm not sure if it was done on purpose or not.

rndusr commented 3 years ago

If that happens to you, it's definitely a bug. Any action that can handle multiple torrents should use the marked torrents and ignore focus.

But I can't reproduce this. I press space-space-...-tm and it moves the marked torrents and leaves the focused torrent where it is.

Soundtoxin commented 3 years ago

I admit there was some guesswork here. I sad that the move prompt displayed the location of the focused unmarked torrent, but I hit esc instead of changing it. Is it possible it was going to move the marked torrents, but just set the wrong current dir in the prompt? In that case I would think it's still a bug, but a different one.

Soundtoxin commented 3 years ago

Okay, I just tested (probably should've just done so before posting again). It is like I started to guess. Although it displays the dir where the focused thing is, when I actually do the move, it is indeed the marked things that it tries to move.

rndusr commented 3 years ago

Which directory would you like to see in the prompt?

Soundtoxin commented 3 years ago

I want to see the current directory of the (4) stopped torrents that are marked, but instead it shows the one of what my cursor happened to be on. Normally it shows the current directory and then changes it to what you set. Here it's basically showing irrelevant info, and if I accidentally hit enter it would actually move a bunch of stuff to an unrelated spot. I guess it's basically just the same behavior as if nothing were marked, but it is confusing this way.

rndusr commented 3 years ago

What if the current directory is not the same for all marked torrents?

Soundtoxin commented 3 years ago

That is an interesting problem. I think the current directory of at least one of the marked torrents should be shown, maybe the last-marked one.

rndusr commented 3 years ago

Why the last one and not the first?

And do you mean the last one in the list or the last one that was marked? (The user can mark a torrent, move up a bunch of times and mark another torrent.)

The issue is that two or more torrents don't have a current directory. I don't think there's a good solution.

Soundtoxin commented 3 years ago

Last one chronologically. I think this is better than first because if you suddenly regret which one was last marked (and thus sets the default location) you can mark another one, even unmark and remark one that was already marked so it's now the "last". If you did it with the first, you'd have to unmark everything to do the same thing.

I have a somewhat related question, what's the syntax to add a keybind that's similar to tm but without showing the current location at all? I tried bind t+M setcommand 'move ' and bind t+M 'setcommand move ' but neither work. (I also tried no single quotes anywhere first) I checked the stig keys help page and the format of the defaults binds it lists already looks different than some binds I have, so I figure it must not be exactly how they go in the rc file. Also they don't use any quoting.

rndusr commented 3 years ago

Thanks. Using the last marked torrent sounds reasonable.

Regarding your keybinding issue: It's messy and overly complicated like most of stig.

This doesn't work: bind t+x setcommand something This works: bind --context torrent t+x setcommand something

Looks like another bug. The "torrent" context grabs "t" and doesn't offer keybindings from other contexts that also apply (like the default context in this case).

Also: Use 'setcommand --trailing-space ...' to get a trailing space.