Skip to content

Instantly share code, notes, and snippets.

@v-yarotsky
Created June 11, 2012 14:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save v-yarotsky/2910319 to your computer and use it in GitHub Desktop.
Save v-yarotsky/2910319 to your computer and use it in GitHub Desktop.
Homebrew tmux formula with mouse scroll down fix
require 'formula'
class TmuxMouseFix < Formula
url 'http://sourceforge.net/projects/tmux/files/tmux/tmux-1.6/tmux-1.6.tar.gz'
md5 '3e37db24aa596bf108a0442a81c845b3'
homepage 'http://tmux.sourceforge.net'
head 'https://tmux.svn.sourceforge.net/svnroot/tmux/trunk'
depends_on 'libevent'
if ARGV.build_head? and MacOS.xcode_version >= "4.3"
depends_on "automake" => :build
depends_on "libtool" => :build
end
def patches
#fix mouse scroll
DATA
end
def install
system "sh", "autogen.sh" if ARGV.build_head?
ENV.append "LDFLAGS", '-lresolv'
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}", "--sysconfdir=#{etc}"
system "make install"
# Install bash completion scripts for use with bash-completion
(prefix+'etc/bash_completion.d').install "examples/bash_completion_tmux.sh" => 'tmux'
end
def caveats; <<-EOS.undent
Bash completion script was installed to:
#{etc}/bash_completion.d/tmux
EOS
end
def test
system "#{bin}/tmux", "-V"
end
end
__END__
commit ea413f3ccacfab5d8b1aed034b92e505f44e14ca
Author: James Nylen <jnylen@gmail.com>
Date: Sun Apr 1 05:04:04 2012 -0400
Fix exiting copy mode with mouse scrolling
Exit copy mode when scrolling off the bottom of the entire history, not
the current visible screen.
diff --git a/window-copy.c b/window-copy.c
index 4f25f3f..dee2750 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -822,7 +822,7 @@ window_copy_mouse(
{
struct window_copy_mode_data *data = wp->modedata;
struct screen *s = &data->screen;
- u_int i, old_cy;
+ u_int i;
if (m->x >= screen_size_x(s))
return;
@@ -835,10 +835,9 @@ window_copy_mouse(
for (i = 0; i < 5; i++)
window_copy_cursor_up(wp, 0);
} else if ((m->b & MOUSE_BUTTON) == MOUSE_2) {
- old_cy = data->cy;
for (i = 0; i < 5; i++)
window_copy_cursor_down(wp, 0);
- if (old_cy == data->cy)
+ if (!data->oy)
goto reset_mode;
}
return;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment