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 on osx 10.11.3? #13

Closed rdbisme closed 8 years ago

rdbisme commented 8 years ago

Hello, I've installed the plugin and it's correctly loaded by tmux.

If I start scrolling it enters in the "mouse mode" but it doesn't scroll with mouse (but just with arrows keys).

.tmux.conf

# Mouse mode
set -g mouse on
setw -g mouse on
set -g terminal-overrides 'xterm*:smcup@:rmcup@'

# Resizing shortcuts
bind j resize-pane -D 10
bind k resize-pane -U 10
bind l resize-pane -L 10
bind h resize-pane -R 10

# Tmux Plugin Manager
set -g @plugin 'tmux-plugin/tpm'
set -g @plugin 'nhdaly/tmux-scroll-copy-mode'

run '~/.tmux/plugins/tpm/tpm' #This should stay at the very end

tmux -V > 2.1

pallxk commented 8 years ago

I encountered the same problem in old versions (before my PR) of this plugin, and found that it was caused by the unavailability of bc which this plugin depended on, (I am using linux based systems and cygwin).

So I did some research on the alternatives to bc, thought that awk is available on most systems, and made a pull request (#10) to substitute bc for awk.

So currently this plugin depends on awk.

I did do some investigation on Linux based systems (Debian, Red Hat, CentOS, Cygwin…), but neglected OS X and BSD systems.

According to this issue and PR #11, it seems that awk is not available on OS X by default. (I'm not familiar with OS X.)

Well, this is embarrassing if it is my PR that caused the problem…

Would you like to help me to confirm the availability of bc and awk on OS X?

rdbisme commented 8 years ago

which awk

/usr/bin/awk

which bc

/usr/bin/

which gawk

/opt/local/bin/gawk //Installed with MacPorts
hughdavenport commented 8 years ago

Hey, my 2c here.

In general, awk is better than bc, as more systems have it. The problem is that Mac OS X ships with an ancient BSD based awk, which isn't compatible. So options for fixing are either a) Add docs to get gawk installed and aliased, or b) Fix the awk script to be more awk agnostic (ie don't have gawk-isms).

Option a is very easy, as you can see from my PR #11 :)

Cheers,

Hugh

NHDaly commented 8 years ago

---- EDIT ----------- Huh, I guess I didn't test the Awk change on my macbook like I thought. I only tested it on my ubuntu box at work. :/

----- /EDIT ----------

Hey, sorry for the delay! Yeah, i'm testing it out on my macbook, and you're right -- no scrolling! :( I do not have gawk installed, which matches what you said, @hughdavenport. After installing it just now with homebrew, everything works as expected.

@pallxk: No problem. It was my responsibility to test it on a macbook, but I guess I forgot! D:

Given that @rubendibattista has gawk installed, but still has the problems, though, do we still think gawk is the answer to @rubendibattista's problems? Could it be that the macports version isn't sufficient? The most recent macports port seems to be the same version as is on homebrew for me (v4.1.3).

@hughdavenport: Thanks for the awesome info on awk. It's good to know. Do you think doing b) will help matters any? Is it easy? There is not a lot of awk dependency in this repo; basically I just need to divide 1 / a decimal to get how many mouse-wheels to ignore.

NHDaly commented 8 years ago

Also, I'm not sure anyone is using that feature, so we could just remove it entirely...

NHDaly commented 8 years ago

So nvm -- adding gawk fixed everything for me. I've edited my previous response to reflect that.

It would be nice to be able to eliminate any external dependencies, though.

hughdavenport commented 8 years ago

I can't recall what it was screwing up on, but I think it was the tests in https://github.com/NHDaly/tmux-scroll-copy-mode/blob/86cef27d690138f1784dc9c330e7f94152ca1650/scroll_copy_mode.tmux. I threw a set -x at the top of the file, then could see all the commands being run, and when the error occurred. Gave a syntax error iirc. Looking at https://github.com/NHDaly/tmux-scroll-copy-mode/search?utf8=%E2%9C%93&q=awk I don't see much difference between the three runs of awk...

Trying on this laptop, which has mawk and gawk. Both like the int(num/num) construct, but mawk doesn't like the >= construct:

$ mawk "BEGIN { print 1 >= 0 }"
mawk: line 1: syntax error at or near =
 $ gawk "BEGIN { print 1 >= 0 }"
1
hughdavenport commented 8 years ago

@NHDaly with just changing it to gawk may lead to similar issues that you had with bc not being on every system. A lot of BSD's (and Mac OS X) don't come with gawk on a clean install. Literally had a fresh Mac Book Pro at the start of this week which is why I came across this issue.

Cheers,

Hugh

NHDaly commented 8 years ago

@hughdavenport: Okay wow, your info on BSD incompatibilities was super duper helpful.

I think I've done b), mentioned above, in 5c94ada. It makes the scrolling work again on my mac! So, woohoo!

Thanks a bunch for your help, @hughdavenport. And for yours, everyone else! :)

@rubendibattista: Can you test out this fix? Let me know if it's still now working for you!

hughdavenport commented 8 years ago

Cool! I'll try that out next week or this weekend if I have time. I'll just unalias the gawk bit and see if it works with my old mac awk (which I'm not sure if it is mawk or not...)

rdbisme commented 8 years ago

@NHDaly @hughdavenport @pallxk Thanks to everyone for the help.

I confirm that the plugin is working with the 5c94ada.

NHDaly commented 8 years ago

Yay