tmux-thumbs icon indicating copy to clipboard operation
tmux-thumbs copied to clipboard

Doesn't work when have 2 or more panes opened

Open vyorkin opened this issue 4 years ago • 24 comments
trafficstars

vyorkin avatar Dec 25 '20 12:12 vyorkin

Great Plugin!

I've been using the Kitty Hints Kitten up to now, however I've recently started looking into tmux-thumbs to streamline by workflow a bit.

One feature I'm missing dearly is to extract patterns from other visible panes.

Consider the following use case: I've two panes open. One with a git log and one with a shell. Now I want to display the diff of a specific commit, for this I type git show in the shell and would like to pick the commit hash form the other pane by invoking tmux-thumbs.

Maybe it would make sense to offer another command, which works on all visible panes?

0xC0FFEE avatar Dec 28 '20 09:12 0xC0FFEE

@vyorkin Can you provide a bit more information to reproduce the bug? Having two or more panes is a really common use case.

@0xC0FFEE Can you open a different issue to track this feature request, please?

fcsonline avatar Dec 30 '20 20:12 fcsonline

I have also stumbled across this issue once or twice. Not really sure during which pane configurations but the next time this happens I will try to take a look or at least note down my tmux configuration and post it here.

TutenStain avatar Jan 08 '21 20:01 TutenStain

I think this is because prefix + space invokes :next-layout by default in tmux.

Source

mahmoudhossam avatar Jan 13 '21 23:01 mahmoudhossam

Just installed and messing a bit with configuration. There is something fishy here for sure. In my tests i was able to replicate it, panes that are horizontal always fail (Rust panic? not sure). If you switch the layout using prefix + space until you have vertical panes it works (even when previously it didn't for the same pane).

Also, if you are in copy-mode, it always works, regardless of pane "orientation"

tmux -V = 3.1c tmux-thumbs = built from master, 0.5.0 i believe

EDIT:

Well, not sure if it's orientation now, sometimes it works, other it does not 🤷 but changing the layouts triggers things

simaoneves avatar Jan 20 '21 17:01 simaoneves

If you are able to reproduce it, it will be awesome. I tried with many layouts, horizontal, vertical, copy mode, zoom, etc, and all of them work for me. I'm in tmux 3.0 and last tmux-thumbs master. Ensure you have the latest tmux-thumbs code compiled in release mode. I fixed some bugs about zooming and panes a few weeks ago.

fcsonline avatar Jan 23 '21 10:01 fcsonline

For me I can reproduce if:

  1. there are 2 panes open (C-b ")
  2. 1 pane is running vim
  3. the cursor is inside the vim pane
  4. I invoke C-b Space (default binding to trigger tmux-thumbs).

It's weird because if I replace Step 1 with the vertical layout (C-b %), Step 4 is flaky (it works sometimes, sometimes not). I also did notice at one point that not all of the strings were getting matched (some IP addresses near the cursor in vim). FWIW if I split with C-b ", Step 4 reliably fails every time AFAICS.

I'm on Mac with Alacritty 0.8.0, tmux 3.2. I installed tmux-thumbs today using tpm.

listx avatar Jun 15 '21 23:06 listx

When there's more thant 2 pane in window. It rarely works. (It works sometimes, but hard to figure out why) It breaks the pane and create new window [thumbs].

aca avatar Feb 02 '22 07:02 aca

I will try to battle test these use cases.

fcsonline avatar Feb 02 '22 22:02 fcsonline

I battle tested in my Linux + tmux 3.0a with multiple panes (vertical and horizontal), moving them, multiple windows and many more and always work. :confused:

fcsonline avatar Feb 06 '22 13:02 fcsonline

for me it always acts weird (buffer jumps backward) when the pane

  • is a horizontal pane (top/bottom)
  • in copy mode

at the same time

tmux 3.2a tmux-thumbs 0.7.1

I'm able to reproduce it consistently on both Mac and WSL let me know what else I can provide

dayyeung avatar Feb 08 '22 02:02 dayyeung

I don't know if that's asking too much, but could you record a video? It's just to understand the behavior.

fcsonline avatar Feb 08 '22 07:02 fcsonline

sure thing!

https://user-images.githubusercontent.com/512178/153084160-1716775a-86c2-4542-90c3-06c6d7f35a07.mp4

note: my prefix binding is C-s

  • no issues when in single pane
  • no issues when in horizontal pane without copy mode
  • when in copy mode, history jumps up
  • when in copy mode and at history top, no hints are shown

dayyeung avatar Feb 08 '22 22:02 dayyeung

So, the problems are related to copy-mode. I'll investigate and test it.

fcsonline avatar Feb 09 '22 18:02 fcsonline

I have been testing in copy-mode and everything works for me. 🤔

Is someone else facing this issue?

fcsonline avatar Feb 11 '22 21:02 fcsonline

@fcsonline

https://asciinema.org/a/2TLriuUFvJaue6VkPbVZkwGDi

[thumbs] pane open and exit directly. Not working also on normal mode.

# minimal config
set -g @thumbs-regexp-1 '\w{1,50}' # Match emails
set -g @thumbs-key w
run ~/.tmux/plugins/tmux-thumbs/tmux-thumbs.tmux
$ tmux -V
tmux next-3.4

$ uname -a
Linux rok-te3 5.16.4-arch1-1 #1 SMP PREEMPT Sat, 29 Jan 2022 19:08:13 +0000 x86_64 GNU/Linux
# also doesn't work on mac

And there's also an issue that it doesn't work if i am using non posix shell (elvish). (Used /bin/sh for the screencast)

aca avatar Feb 12 '22 08:02 aca

I have tested this configuration in my bash terminal, and it works. :/ Also, with /bin/sh works.

Could you try a thing?

Try to run this: ls -la | ~/.tmux/plugins/tmux-thumbs/target/release/thumbs

This will run thumbs in standalone mode, without the tmux integration. It is just to bisect the issue.

fcsonline avatar Feb 12 '22 20:02 fcsonline

image

Output is messy (doesn't wrap) but works.

aca avatar Feb 14 '22 02:02 aca

I was running into the issue every time I opened a pane vertically (below current).

I wrote a small wrapper script for tmux, logging all calls to files, and I realised that depending on trivial changes in this wrapper, I would encounter the bug or not. Skipping on the details, but it looks like the bug occurring or not depends on the order of execution of tmux capture-pane and tmux swap-pane -d -s ... -t ....

Then I added a pause in the main function of swapper.rs, which fixes the issue.

  swapper.execute_thumbs();
  std::thread::sleep(std::time::Duration::from_millis(10));
  swapper.swap_panes();

I still don't understand why, as execute_thumbs() is not async afaics. But then I don't know much rust :)

perpen avatar Mar 27 '22 14:03 perpen

I can't understand how is this possible, because as you said, everything is sync and the process waits all the commands to finish.

fcsonline avatar Apr 04 '22 06:04 fcsonline

I just installed thumbs on my work mac, and I have been getting the same problem as I was on linux. And the sleep() call fixed it here as well. For this to happen on such a completely different env, there may be something about my tmux.conf. IIRC I had gone back to an almost empty tmux.conf in March and still had the problem, but maybe I didn't do it right. Maybe I'll test it sometime.

perpen avatar Jun 14 '22 10:06 perpen

By any chance, is this issue related to the fact that activating tmux-thumbs in a window with split panes (horizontal or vertical) only shows hints in the current pane? This is a screencast that explains better the issue:

https://user-images.githubusercontent.com/599274/190931411-f5bc267a-ceb6-49a7-ad8f-f318898f4f87.mp4

ghost avatar Sep 18 '22 22:09 ghost

I also have the same issue this is probably related to some conflicting key binding that another plugin is making for sure right?

I always asumed this was the default behavior. working only on one pane.

dagadbm avatar Jan 05 '23 10:01 dagadbm

might be a long shot but I also use asdf and a rust compiled version of tmux-thumbs so the binary is being managed by asdf.

dagadbm avatar Jan 05 '23 10:01 dagadbm