From: Andreas Schwab Date: Thu, 28 Jul 2011 18:40:28 +0000 (+0200) Subject: Fixes: debbugs:6594 X-Git-Tag: emacs-pretest-24.0.90~104^3~8 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=29bbcfa7054e69db0dbe8250af2c809b39ecb54d;p=emacs.git Fixes: debbugs:6594 * lisp/xt-mouse.el (xterm-mouse-event-read): Try to recover the raw character. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1b401bf7582..a42c0127ff5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2011-07-28 Andreas Schwab + + * xt-mouse.el (xterm-mouse-event-read): Try to recover the raw + character. (Bug#6594) + 2011-07-12 Chong Yidong * window.el (split-window-horizontally): Doc fix (Bug#9060). 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."