putty is sending mouse input that isn't really kosher to extend the
range from 223 to 256. but since we actually can send the same on output
now we might as well accept in on input, please try this:

if you still see problems with this then please send me the same logs
again running with this patch

diff --git a/tty-keys.c b/tty-keys.c
index 3055f39..d1c9d87 100644
--- a/tty-keys.c
+++ b/tty-keys.c
@@ -676,11 +676,17 @@ tty_keys_mouse(struct tty *tty, const char *buf, size_t 
len, size_t *size)
                log_debug("mouse input: %.*s", (int) *size, buf);
 
                /* Check and return the mouse input. */
-               if (b < 32 || x < 33 || y < 33)
+               if (b < 32)
                        return (-1);
                b -= 32;
-               x -= 33;
-               y -= 33;
+               if (x >= 33)
+                       x -= 33;
+               else
+                       x = 256 - x;
+               if (y >= 33)
+                       y -= 33;
+               else
+                       y = 256 - y;
        } else if (buf[2] == '<') {
                /* Read the three inputs. */
                *size = 3;



On Thu, Aug 01, 2013 at 06:15:21PM -0400, Naseer Ahmed wrote:
>    Thank you for your quick responses :)
>    Requested logs are attached.
> 
>    On Thu, Aug 1, 2013 at 6:12 PM, Nicholas Marriott
>    <[1]nicholas.marri...@gmail.com> wrote:
> 
>      Can you detach your existing tmux, run a new one with "tmux -Ltest -vvvv
>      new" then reproduce, exit that tmux and send me the server log from the
>      current directory.
> 
>      On Thu, Aug 01, 2013 at 06:03:24PM -0400, Naseer Ahmed wrote:
>      > ** **naseer@naseer-linux:~ $ cat
>      > ** **^[[M`
>      > ** **G^[[M#
>      > ** ****`
>      > ** ****#
>      > ** **^[[M`
>      > ** **G^[[M#
>      > ** **** `
>      > ** ****#
>      > ** **^[[M`
>      > ** **G^[[M#
>      > ** **** `
>      > ** ****#
>      >
>      > ** **On Thu, Aug 1, 2013 at 6:01 PM, Nicholas Marriott
>      > ** **<[1][2]nicholas.marri...@gmail.com> wrote:
>      >
>      > ** ** **Can you run cat inside tmux and tell me exactly what it shows
>      when you
>      > ** ** **scroll outside?
>      >
>      > ** ** **On Thu, Aug 01, 2013 at 05:52:32PM -0400, Naseer Ahmed wrote:
>      > ** ** **> ** **I am on the tip of the tree from sourceforge (just
>      compiled tmux)
>      > ** ** **> ** **Windows doesn't have "focus follows mouse" so putty
>      will send a
>      > ** ** **scroll
>      > ** ** **> ** **event even if I scroll outside the window. When I have
>      vim open,
>      > ** ** **it
>      > ** ** **> ** **scrolls as expected.
>      > ** ** **> ** **I have UTF-8 mouse mode enabled (set -g mouse-utf8 on)
>      > ** ** **> ** **I am not deliberately scrolling outside the window - I
>      have a
>      > ** ** **dual monitor
>      > ** ** **> ** **set up and sometimes I scroll without switching the
>      window focus
>      > ** ** **and it
>      > ** ** **> ** **dumps junk into my tmux terminal.
>      > ** ** **>
>      > ** ** **> ** **On Thu, Aug 1, 2013 at 5:45 PM, Nicholas Marriott
>      > ** ** **> ** **<[1][2][3]nicholas.marri...@gmail.com> wrote:
>      > ** ** **>
>      > ** ** **> ** ** **The fact that putty is sending anything at all when
>      you scroll
>      > ** ** **outside
>      > ** ** **> ** ** **the window sounds like a putty bug.
>      > ** ** **>
>      > ** ** **> ** ** **It's obviously sending something tmux doesn't
>      understand,
>      > ** ** **probably
>      > ** ** **> ** ** **because it's too big for standard mouse reporting
>      and you are
>      > ** ** **using an
>      > ** ** **> ** ** **old version of tmux where the range is smaller, or
>      you need to
>      > ** ** **enable
>      > ** ** **> ** ** **UTF-8 mouse mode.
>      > ** ** **>
>      > ** ** **> ** ** **On Thu, Aug 01, 2013 at 05:16:14PM -0400, Naseer
>      Ahmed wrote:
>      > ** ** **> ** ** **> ** **Posted this question on superuser - posting
>      it here in
>      > ** ** **case I get
>      > ** ** **> ** ** **an
>      > ** ** **> ** ** **> ** **answer
>      > ** ** **> ** ** **> **
>      > ** ** **> ** **
>      > ** **
>      
> ******[1][2][3][4]http://superuser.com/questions/617082/tmux-putty-using-mouse-off-window-shows-
>      > ** ** **> ** ** **> ** **junk-characters
>      > ** ** **> ** ** **>
>      > ** ** **> ** ** **> ** **Setup: tmux 1.8 running on Ubuntu 12.04
>      connecting from
>      > ** ** **Windows
>      > ** ** **> ** ** **with
>      > ** ** **> ** ** **> ** **Putty. tmux has mouse mode on.
>      > ** ** **> ** ** **>
>      > ** ** **> ** ** **> ** **Steps to reproduce: Select the putty window
>      as active,
>      > ** ** **but use
>      > ** ** **> ** ** **the mouse
>      > ** ** **> ** ** **> ** **off the window (i.e in another window)
>      Typically this
>      > ** ** **happens
>      > ** ** **> ** ** **when I am
>      > ** ** **> ** ** **> ** **scrolling in another application on another
>      monitor but
>      > ** ** **forgot to
>      > ** ** **> ** ** **switch
>      > ** ** **> ** ** **> ** **the mouse focus.Also, this seems to only
>      happen if the
>      > ** ** **putty
>      > ** ** **> ** ** **window is
>      > ** ** **> ** ** **> ** **large or maximized.
>      > ** ** **> ** ** **>
>      > ** ** **> ** ** **> ** **Issue: Junk commands get dumped into tmux
>      (e.g 7#, H#,
>      > ** ** **7a etc.)
>      > ** ** **> ** ** **If I
>      > ** ** **> ** ** **> ** **scroll off window with only PuTTY (no tmux)
>      the screen
>      > ** ** **scrolls as
>      > ** ** **> ** ** **> ** **expected.
>      > ** ** **> ** ** **>
>      > ** ** **> ** ** **> ** **(Screenshot at that superuser link)
>      > ** ** **> ** ** **>
>      > ** ** **> ** ** **> References
>      > ** ** **> ** ** **>
>      > ** ** **> ** ** **> ** **Visible links
>      > ** ** **> ** ** **> ** **1.
>      > ** ** **> ** **
>      > ** **
>      
> ****[3][4][5]http://superuser.com/questions/617082/tmux-putty-using-mouse-off-window-shows-junk-characters
>      > ** ** **>
>      > ** ** **> ** ** **>
>      > ** ** **> ** **
>      > ** **
>      
> ****------------------------------------------------------------------------------
>      > ** ** **> ** ** **> Get your SQL database under version control now!
>      > ** ** **> ** ** **> Version control is standard for application code,
>      but
>      > ** ** **databases havent
>      > ** ** **> ** ** **> caught up. So what steps can you take to put your
>      SQL
>      > ** ** **databases under
>      > ** ** **> ** ** **> version control? Why should you start doing it?
>      Read more to
>      > ** ** **find out.
>      > ** ** **> ** ** **>
>      > ** ** **> ** **
>      > ** **
>      
> ****[4][5][6]http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
>      > ** ** **>
>      > ** ** **> ** ** **> _______________________________________________
>      > ** ** **> ** ** **> tmux-users mailing list
>      > ** ** **> ** ** **> [5][6][7]tmux-users@lists.sourceforge.net
>      > ** ** **> ** ** **>
>      > ** **
>      **[6][7][8]https://lists.sourceforge.net/lists/listinfo/tmux-users
>      > ** ** **>
>      > ** ** **> References
>      > ** ** **>
>      > ** ** **> ** **Visible links
>      > ** ** **> ** **1. mailto:[8][9]nicholas.marri...@gmail.com
>      > ** ** **> ** **2.
>      > ** **
>      
> **[9][10]http://superuser.com/questions/617082/tmux-putty-using-mouse-off-window-shows-
>      > ** ** **> ** **3.
>      > ** **
>      
> **[10][11]http://superuser.com/questions/617082/tmux-putty-using-mouse-off-window-shows-junk-characters
>      > ** ** **> ** **4.
>      > ** **
>      
> **[11][12]http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
>      > ** ** **> ** **5. mailto:[12][13]tmux-users@lists.sourceforge.net
>      > ** ** **> ** **6.
>      [13][14]https://lists.sourceforge.net/lists/listinfo/tmux-users
>      >
>      > References
>      >
>      > ** **Visible links
>      > ** **1. mailto:[15]nicholas.marri...@gmail.com
>      > ** **2. mailto:[16]nicholas.marri...@gmail.com
>      > ** **3.
>      
> [17]http://superuser.com/questions/617082/tmux-putty-using-mouse-off-window-shows-
>      > ** **4.
>      
> [18]http://superuser.com/questions/617082/tmux-putty-using-mouse-off-window-shows-junk-characters
>      > ** **5.
>      
> [19]http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
>      > ** **6. mailto:[20]tmux-users@lists.sourceforge.net
>      > ** **7. [21]https://lists.sourceforge.net/lists/listinfo/tmux-users
>      > ** **8. mailto:[22]nicholas.marri...@gmail.com
>      > ** **9.
>      
> [23]http://superuser.com/questions/617082/tmux-putty-using-mouse-off-window-shows-
>      > ** 10.
>      
> [24]http://superuser.com/questions/617082/tmux-putty-using-mouse-off-window-shows-junk-characters
>      > ** 11.
>      
> [25]http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
>      > ** 12. mailto:[26]tmux-users@lists.sourceforge.net
>      > ** 13. [27]https://lists.sourceforge.net/lists/listinfo/tmux-users
> 
> References
> 
>    Visible links
>    1. mailto:nicholas.marri...@gmail.com
>    2. mailto:nicholas.marri...@gmail.com
>    3. mailto:nicholas.marri...@gmail.com
>    4. 
> http://superuser.com/questions/617082/tmux-putty-using-mouse-off-window-shows-
>    5. 
> http://superuser.com/questions/617082/tmux-putty-using-mouse-off-window-shows-junk-characters
>    6. 
> http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
>    7. mailto:tmux-users@lists.sourceforge.net
>    8. https://lists.sourceforge.net/lists/listinfo/tmux-users
>    9. mailto:nicholas.marri...@gmail.com
>   10. 
> http://superuser.com/questions/617082/tmux-putty-using-mouse-off-window-shows-
>   11. 
> http://superuser.com/questions/617082/tmux-putty-using-mouse-off-window-shows-junk-characters
>   12. 
> http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
>   13. mailto:tmux-users@lists.sourceforge.net
>   14. https://lists.sourceforge.net/lists/listinfo/tmux-users
>   15. mailto:nicholas.marri...@gmail.com
>   16. mailto:nicholas.marri...@gmail.com
>   17. 
> http://superuser.com/questions/617082/tmux-putty-using-mouse-off-window-shows-
>   18. 
> http://superuser.com/questions/617082/tmux-putty-using-mouse-off-window-shows-junk-characters
>   19. 
> http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
>   20. mailto:tmux-users@lists.sourceforge.net
>   21. https://lists.sourceforge.net/lists/listinfo/tmux-users
>   22. mailto:nicholas.marri...@gmail.com
>   23. 
> http://superuser.com/questions/617082/tmux-putty-using-mouse-off-window-shows-
>   24. 
> http://superuser.com/questions/617082/tmux-putty-using-mouse-off-window-shows-junk-characters
>   25. 
> http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
>   26. mailto:tmux-users@lists.sourceforge.net
>   27. https://lists.sourceforge.net/lists/listinfo/tmux-users





------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to