NHDaly / tmux-better-mouse-mode

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

Scrolling not working nor Right-click #32

Open seanw2020 opened 6 years ago

seanw2020 commented 6 years ago

Disclaimer: I'm new to this plugin and tmux.

I'm seeing the following problems:

  1. scrolling up on my scrollwheel cycles through previous commands not history
  2. if I press Prefix [ first, then scrollwheel works
  3. if I select some text, I enter copy-mode and scrollwheel works (if I keep left button pressed)
  4. scroll-without-changing-pane doesn't work

Details below:

$ tmux -V tmux 2.5

$ tmux list-keys -T root

bind-key -T root MouseDown1Pane   select-pane -t = ; send-keys -M
bind-key -T root MouseDown1Status select-window -t =
bind-key -T root MouseDown3Pane   if-shell -F -t = "#{mouse_any_flag}" "select-pane -t=; send-keys -M" "select-pane -mt="
bind-key -T root MouseDrag1Pane   if-shell -F -t = "#{mouse_any_flag}" "if -Ft= \"#{pane_in_mode}\" \"copy-mode -M\" \"send-keys -M\"" "copy-mode -M"
bind-key -T root MouseDrag1Border resize-pane -M
bind-key -T root WheelUpPane      if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "         if -Ft= '#{alternate_on}'           \"send-keys up ; send-keys up ; send-keys up ; \"           \"                          if -Ft= '#{pane_in_mode}'               'send-keys -M ; send-keys -M ; send-keys -M ; '               'copy-mode -e -t= ; send-keys -M ; send-keys -M ; send-keys -M ; '           \"       "
bind-key -T root WheelUpStatus    previous-window
bind-key -T root WheelDownPane    if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "         if -Ft= \"#{alternate_on}\"           \"send-keys down ; send-keys down ; send-keys down ; \"           \" send-keys -M ; send-keys -M ; send-keys -M ; \"       "
bind-key -T root WheelDownStatus  next-window
$ cat /etc/os-release
NAME="Red Hat Enterprise Linux Server"
VERSION="7.4 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.4"
PRETTY_NAME="Red Hat Enterprise Linux"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.4:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

$ cat ~/.tmux.conf
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'seebi/tmux-colors-solarized'
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'tmux-plugins/tmux-cpu'
set -g @plugin 'nhdaly/tmux-better-mouse-mode'

# Seans settings
set -g @colors-solarized 'light'

# Change the prefix key to C-a
set -g prefix C-a
unbind C-b
bind C-a send-prefix

# Allow vim key bindings in copy mode
set-window-option -g mode-keys vi

# mouse support
set-option -g mouse on
set -g @scroll-without-changing-pane "on"
#set -g @emulate-scroll-for-no-mouse-alternate-buffer "on"

# CPU settings
set -g status-right '#{cpu_bg_color} CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M '
set -g @cpu_low_icon ""
set -g @cpu_medium_icon ""
set -g @cpu_high_icon ""

set -g @cpu_low_fg_color "#[fg=#000000]"
set -g @cpu_medium_fg_color "#[fg=#000000]"
set -g @cpu_high_fg_color "#[fg=#000000]"

set -g @cpu_low_bg_color "#[bg=#FF99FF]"
set -g @cpu_medium_bg_color "#[bg=#3399FF]"
set -g @cpu_high_bg_color "#[bg=#CCFFFF]"

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

Prefix U:
Installed plugins:                                                                                                                              [0/0]
  tpm
  tmux-sensible
  tmux-colors-solarized
  tmux-pain-control
  tmux-cpu
  tmux-better-mouse-mode
Type plugin name to update it.
- "all" - updates all plugins
- ENTER - cancels
NHDaly commented 6 years ago

Hi! Thanks for the detailed output. Hopefully we can figure out what's going on...

First, quick clarification, I think there's a mismatch between what you posted from $ tmux list-keys -T root and the .tmux.conf you posted. I think you posted the list-keys output before you commented-out the @emulate-scroll-for-no-mouse-alternate-buffer line. When I installed tmux v2.5, and used your .tmux.conf, I got the following diff between the output of our list-keys -T root:

    6    if -Ft= '#{alternate_on}'      |    6    if -Ft= ''
    7                                   |    7
    8    if -Ft= \"#{alternate_on}\"    |    8    if -Ft= \"\"
    9                                   |    9

But I think that can be entirely explained with the above assumption. In particular, when I uncommented the option, our outputs were identical.


That said, either way, I do not see the problems you describe, unfortunately. I do actually see number 4, though! It seems like @scroll-without-changing-pane doesn't work anymore. I need to investigate that (I've opened #33!)

But I do not experience problem 1. Also, nor do I experience number 3, since when I let go of the mouse-button it leaves copy-mode... I wonder if this is somehow a behavior related to your terminal.

Does mouse-mode work in other programs? For example, if you enable mouse-mode in vim (:set mouse=a) does scrolling move the background page (working) or just move the cursor (not working)?

NHDaly commented 6 years ago

Hey @seanw2020: So, @iamjamestl made some changes that fix the behavior for Solaris and other non-GNU systems in #28. Red Hat is GNU/Linux, but maybe it still has some difference from my machine that was fixed in #28? Can you please update and let me know if you still have a problem? thanks!