NHDaly / tmux-better-mouse-mode

A tmux plugin to better manage and configure the mouse.
MIT License
910 stars 27 forks source link

add option to scroll unselected panes #3

Closed woutgg closed 8 years ago

woutgg commented 8 years ago

Before the mouse overhaul, automatic enter/exit of copy mode also worked on other panes than the active one, i.e., the one over which the mouse cursor is located instead. It would be nice to have this behaviour again since this allows for easier and quicker use of scrollback buffers.

NHDaly commented 8 years ago

Oooph, you're right. This is not great. Any ideas what the configuration change should be?

NHDaly commented 8 years ago

Looks like add select-pane -t=; before copy-mode will do the trick, credit @milosivanovic: https://github.com/tmux/tmux/issues/145#issuecomment-151123624.

I'm adding that now.

woutgg commented 8 years ago

Yes, that fix seems to work great, thanks! However, the same change is required for the WheelDownPane event, so I think it looks like below. (This also fixes the scroll-on-first-event issue mentioned in the other thread.)

  tmux bind-key -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' \"select-pane -t= \; $enter_copy_mode_cmd \; send-keys -M\""
  tmux bind-key -n WheelDownPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' \"select-pane -t= \; send-keys -M\""
NHDaly commented 8 years ago

Thanks, good point; I realized that too after adding just the first line.

I was actually able to get this to work with the much simpler tmux bind-key -n WheelDownPane send-keys -M -t =.

I added these two lines in fd78e441c. This should now be fixed.

NHDaly commented 8 years ago

Ah, never mind. I was missing a detail: the way I had it, it didn't select the pane, just scrolled in it. I've changed it now to your suggestion. Thanks @woutgg.

Fixed in 19e602f795f08.

NHDaly commented 8 years ago

Also, I've added c28119ac90045 which adds an option @scroll-without-changing-pane, off by default, to allow scrolling without selecting the pane.

This is not how tmux 2.0 worked, but I prefer it working this way. :) Thanks again @woutgg.

woutgg commented 8 years ago

Great @NHDaly! Thanks so much for your effort! I had not even noticed the pane selection issue yet.

Two remarks:

NHDaly commented 8 years ago

:) no problem. Thanks for the thorough followups!

woutgg commented 8 years ago

Could this a bug in send-keys then?

I've noticed a second, similar effect. To reproduce:

It does not seem to matter which one is the selected pane, and adding -t= to send-keys does not change anything as you already mentioned. I'm at a loss here.

NHDaly commented 8 years ago

Hmm, I do not notice that effect at all. :(

BUT, that said, you did cause me to find another bug, which is that as I had it, selecting the moused-over pane only happened when entering copy-mode but not when scrolling once you were already in copy-mode.

To fix that i've added a select-pane -t= to before the send-keys -M for the #{pane_in_mode} case: Fixed in 893e1b1ddde5d34280d3a30be7438b07d3da4d5b.

woutgg commented 8 years ago

Maybe it was due to your last fix, the glitch I described seems to be gone. I'm happily scrolling away now. :) Thanks again for your work!

NHDaly commented 8 years ago

:D Glad to hear it! Thank you for being so persistent and going through this with me!

Me too!!! <_scroll scroll scroll_>

On Mon, Nov 16, 2015 at 4:27 AM, Wouter R. notifications@github.com wrote:

Maybe it was due to your last fix, the glitch I described seems to be gone. I'm happily scrolling away now. :) Thanks again for your work!

— Reply to this email directly or view it on GitHub https://github.com/NHDaly/tmux-scroll-copy-mode/issues/3#issuecomment-157012741 .

woutgg commented 8 years ago

:D