Closed rdbisme closed 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?
which awk
/usr/bin/awk
which bc
/usr/bin/
which gawk
/opt/local/bin/gawk //Installed with MacPorts
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
---- 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.
Also, I'm not sure anyone is using that feature, so we could just remove it entirely...
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.
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
@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
@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!
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...)
@NHDaly @hughdavenport @pallxk Thanks to everyone for the help.
I confirm that the plugin is working with the 5c94ada.
Yay
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
tmux -V
> 2.1