tmux-yank stops working after one yank when tmux-copycat is present.
gregorias opened this issue · 13 comments
I've noticed that "y" and "Y" keyboard shortcuts stopped working after one operation. That is:
- I have
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-yank'
in my tmux.conf
2. I enter a copy mode with <C-[> and select text.
3. I press y to copy the text.
4. I repeat steps 2. and 3., but pressing "y" and "Y" doesn't have any visible effect.
Yanking works correctly if I don't turn on tmux-copycat.
The reason they stop working is that somewhere between 3. and 4. the binding for copy-mode{-vi} {y, Y} gets switched to send-keys -X copy-pipe-and-cancel "\"\"xclip\"" -selection "\"clipboard\"\"
from send-keys -X copy-pipe-and-cancel "xclip -selection clipboard"
.
Tmux: 2.6
tmux-yank and tmux-copycat: current HEADs
Terminal: suckless
Let me know if help is needed reproducing this bug.
OK, I've just checked and it's still present =/
I've created the fix and explained the bug in the commit message. Would you be willing to take it from here?
@gregorias your fix didn't work for me.
@oblitum Could you provide any useful, actionable information such as steps to reproduce?
Is your problem really the same as described in this bug, or is it just that yanking work for you?
Let us know what's the output of tmux list-keys around scripts/copycat_mode_quit.sh:22
@oblitum Could you provide any useful, actionable information such as steps to reproduce?
Is your problem really the same as described in this bug, or is it just that yanking work for you?
My problem is exactly as you described yours, except that it shows up when I first use tmux-copycat at least once. After that, tmux-yank stops yanking, and this was described quite a long time back before #119 got merged.
Let us know what's the output of tmux list-keys around scripts/copycat_mode_quit.sh:22
I didn't understand what I should try here. Is it to put the command tmux list-keys
in there and I will get tmux output?
except that it shows up when I first use tmux-copycat at least once.
I don't understand why "except". Do steps 2. and 3. do not constitute using copycat? They do to me, as copycat code is executed when they are run.
I didn't understand what I should try here. Is it to put the command tmux list-keys in there and I will get tmux output?
Yes, before and after. You can get the output by redirecting to a file.
After that, tmux-yank stops yanking, and this was described quite a long time back before #119 got merged.
The issue doesn't mention the mangled bind-key being the issue. That's why I'm asking whether it is indeed the case. The proposed PR should at least unmangle the post-ante binding.
except that it shows up when I first use tmux-copycat at least once.
I don't understand why "except". Do steps 2. and 3. do not constitute using copycat? They do to me, as copycat code is executed when they are run.
@gregorias ah right, sorry, indeed I didn't pay attention that was an use example, so the reproduction is just the same.
The issue doesn't mention the mangled bind-key being the issue. That's why I'm asking whether it is indeed the case. The proposed PR should at least unmangle the post-ante binding.
Have you checked this and the answer following, is it related?
This is before and after tmux list-keys
created on the first time I type ctrl-b ctrl-f
to use copycat for the first time:
yank works on this first time, not afterwards anymore.
Have you checked this and the answer following, is it related?
#109 (comment)
Thanks for pointing to the specific comment. The buggy behaviour -- yanking doesn't work the second time -- is the same, but the issue mentioned there is different. Namely, #119 has fixed the issue in #109, but hasn't fixed the bug as there is another issue: incorrect restoration of old key-bindings.
yank works on this first time, not afterwards anymore.
Yes, that's the buggy behaviour: on that we're on the same page. Generally the causes lie in incorrect copy mode quit behaviour. #119 has addressed one cause, and this issue (#121) is about another.
This is before and after tmux list-keys created on the first time I type ctrl-b ctrl-f to use copycat for the first time:
Thanks! I apologize for doubting you, but are you sure that that you are using #122? You do have the same issue as I do. The binding of copy-mode-vi y is bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "\"xclip" -selection "clipboard\""
, which is incorrect: #122 should have addressed that.
If you want to fix your issue, then I recommend:
- Reading #122's message to understand what's happening.
- Verifying on your workstation that it is indeed the case that after copycat_mode_quit.sh:22 the binding is changed to an incorrect one. I implanted "echo MSG >> /tmp/copycat.log" commands into the script to debug what's happening.
- Finding out what exact arguments does
sh -c
receive and why does it lead to that incorrect binding.
I'm afraid you will need to be more hands-on with this one if you want to address it. I can't fix a bug that I can't reproduce, i.e. exists only on your machine.
OK. I'll check later. Regarding bullets 1.
and 2.
, I've patched manually the script incorporating your fix, so surely the patch is there and I've verified before applying the test. Next step is just putting more logs as you suggested.