]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/xt-mouse.el (xterm-mouse--read-event-sequence-1000):
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 5 May 2014 23:50:20 +0000 (19:50 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 5 May 2014 23:50:20 +0000 (19:50 -0400)
Always store button numbers in the same way in xterm-mouse-last;
Don't burp is xterm-mouse-last is not set as expected.
Never return negative indices.

Fixes: debbugs:17378
lisp/ChangeLog
lisp/xt-mouse.el

index 7c838a61fe57bb68c22a19b191347f3af8ec044d..043a0c240b1f599345bc3790c3d3c9a8d434087d 100644 (file)
@@ -1,3 +1,10 @@
+2014-05-05  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * xt-mouse.el (xterm-mouse--read-event-sequence-1000): (bug#17378)
+       Always store button numbers in the same way in xterm-mouse-last;
+       Don't burp is xterm-mouse-last is not set as expected.
+       Never return negative indices.
+
 2014-05-05  Dmitry Gutov  <dgutov@yandex.ru>
 
        * progmodes/ruby-mode.el (ruby-syntax-propertize-function):
index 26a07b468407c2f263e8fa3948f38bdbf0270d21..87e65f7e117b89c3f839e89f54482dbe53c24c51 100644 (file)
@@ -161,10 +161,10 @@ http://invisible-island.net/xterm/ctlseqs/ctlseqs.html)."
           (cond ((>= code 64)
                  (format "mouse-%d" (- code 60)))
                 ((memq code '(8 9 10))
-                 (setq xterm-mouse-last code)
+                 (setq xterm-mouse-last (- code 8))
                  (format "M-down-mouse-%d" (- code 7)))
                 ((= code 11)
-                 (format "M-mouse-%d" (- xterm-mouse-last 7)))
+                 (format "M-mouse-%d" (+ 1 (or xterm-mouse-last 0))))
                 ((= code 3)
                  ;; For buttons > 5 xterm only reports a
                  ;; button-release event.  Avoid error by mapping
@@ -174,8 +174,8 @@ http://invisible-island.net/xterm/ctlseqs/ctlseqs.html)."
                  (setq xterm-mouse-last code)
                  (format "down-mouse-%d" (+ 1 code))))))
        ;; x and y coordinates
-       (- (read-event) 33)
-       (- (read-event) 33)))
+       (max 0 (- (read-event) 33))
+       (max 0 (- (read-event) 33))))
 
 ;; XTerm's 1006-mode terminal mouse click reporting has the form
 ;; <BUTTON> ; <X> ; <Y> <M or m>, where the button and ordinates are