summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2014-05-05 19:50:20 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2014-05-05 19:50:20 -0400
commitc22f24f6ef76b6bc62bbaafb0b1423bff3d867d4 (patch)
treefca84d984069ce672a2be5fc910a0c7e46ef5cb8
parent4dd3c4d53af81b017363cb778ac6fd5abea2d132 (diff)
downloademacs-c22f24f6ef76b6bc62bbaafb0b1423bff3d867d4.tar.gz
* lisp/xt-mouse.el (xterm-mouse--read-event-sequence-1000):
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
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/xt-mouse.el8
2 files changed, 11 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7c838a61fe5..043a0c240b1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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):
diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el
index 26a07b46840..87e65f7e117 100644
--- a/lisp/xt-mouse.el
+++ b/lisp/xt-mouse.el
@@ -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