summaryrefslogtreecommitdiff
path: root/lisp/xt-mouse.el
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2011-07-28 20:40:28 +0200
committerAndreas Schwab <schwab@linux-m68k.org>2011-07-28 20:40:28 +0200
commit29bbcfa7054e69db0dbe8250af2c809b39ecb54d (patch)
tree73e3b84e2b689e84604ebc1150e269920e3cdf7b /lisp/xt-mouse.el
parentc897048c52b767decd44fa59805f80cd71ae9050 (diff)
downloademacs-29bbcfa7054e69db0dbe8250af2c809b39ecb54d.tar.gz
Fixes: debbugs:6594
* lisp/xt-mouse.el (xterm-mouse-event-read): Try to recover the raw character.
Diffstat (limited to 'lisp/xt-mouse.el')
-rw-r--r--lisp/xt-mouse.el13
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el
index 5a70e6a6808..f917287d2d9 100644
--- a/lisp/xt-mouse.el
+++ b/lisp/xt-mouse.el
@@ -121,10 +121,17 @@
;; read xterm sequences above ascii 127 (#x7f)
(defun xterm-mouse-event-read ()
+ ;; We get the characters decoded by the keyboard coding system. Try
+ ;; to recover the raw character.
(let ((c (read-char)))
- (if (> c #x3FFF80)
- (+ 128 (- c #x3FFF80))
- c)))
+ (cond ;; If meta-flag is t we get a meta character
+ ((>= c ?\M-\^@)
+ (- c (- ?\M-\^@ 128)))
+ ;; Reencode the character in the keyboard coding system, if
+ ;; this is a non-ASCII character.
+ ((>= c #x80)
+ (aref (encode-coding-string (string c) (keyboard-coding-system)) 0))
+ (t c))))
(defun xterm-mouse-truncate-wrap (f)
"Truncate with wrap-around."