From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.bugs Subject: bug#23009: 25.0.92; xterm-mouse-mode should not assume UTF-8 coordinates Date: Mon, 14 Mar 2016 13:56:41 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1457960295 4719 80.91.229.3 (14 Mar 2016 12:58:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Mar 2016 12:58:15 +0000 (UTC) To: 23009@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Mar 14 13:58:09 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1afS4W-0007hf-DU for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Mar 2016 13:58:08 +0100 Original-Received: from localhost ([::1]:40846 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afS4V-0004DV-S1 for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Mar 2016 08:58:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34244) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afS4R-0004DD-E9 for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2016 08:58:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1afS4Q-0001AY-3o for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2016 08:58:03 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:50389) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afS4Q-0001AR-1E for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2016 08:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1afS4P-0004kc-Ps for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2016 08:58:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Mar 2016 12:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 23009 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.145796022518183 (code B ref -1); Mon, 14 Mar 2016 12:58:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Mar 2016 12:57:05 +0000 Original-Received: from localhost ([127.0.0.1]:47515 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1afS3V-0004jD-7P for submit@debbugs.gnu.org; Mon, 14 Mar 2016 08:57:05 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:43048) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1afS3T-0004ij-F0 for submit@debbugs.gnu.org; Mon, 14 Mar 2016 08:57:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1afS3N-0000hb-5f for submit@debbugs.gnu.org; Mon, 14 Mar 2016 08:56:58 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:33407) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afS3N-0000hU-2N for submit@debbugs.gnu.org; Mon, 14 Mar 2016 08:56:57 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afS3L-0003zw-PM for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2016 08:56:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1afS3G-0000fP-RA for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2016 08:56:55 -0400 Original-Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]:34574) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afS3G-0000fH-G5 for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2016 08:56:50 -0400 Original-Received: by mail-wm0-x234.google.com with SMTP id p65so100517257wmp.1 for ; Mon, 14 Mar 2016 05:56:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=cHv4MGzLd/4S4H4b8lLfUM/MU2IrKqgeDFJLkT33jAI=; b=MKW9lKpuVKK9NUNZGVxNi7snUwAQsy6+/T7DZnazI9qeneAJqPnxTvk0jvSAIDMKzT 97qv0t636T8MIzj/S+7JltyAhag5QoZcfPN1ImN0MsCmBRcNDXJw7KBF+FGgLmqeVlDq d56vyLzeYk1EuXIqhzCKw/iy4gXAbULqvtx8JncD8R+w39f9zb/Fv20StrwUPje1AedH W/8N1mFF6NhPR3ecOnDslnsMVe7Geh4/R9wV5hgfGqqMA07yysjmYh1oU4LU32gypdcR 3cz1xGgI76f+dKU7s+sLYHwZZyKbR2gYSDhLimU3jq3TEb2pM0ioD8bjSAGNHVW25Q0t cGKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=cHv4MGzLd/4S4H4b8lLfUM/MU2IrKqgeDFJLkT33jAI=; b=jMoR9GVUnv/rJwiMh9L9dt2Ybx3CZav1SwobrHqJYyr/vqmme2gQdKd2xKOyo6kUEa 1I4WZPTeLFMXHTyDTu8zKZ4x2yiR/4mP9xy2h14oXQOrHmq33Lz80M6zMwW+PCszHmF0 z3+Ox0mbjtw36eaDf95YKBn9UZwMM3jlCXCF9/KMNHf+HN8y1hAYQBBpehD6rYYo5s3O Uj9+TwuTdZW0XTbmDJJ7lJpYGt0dZcEqPOL7EmsubFGu9MvxXnN8v39sPT5wYBUWfODY GGgrs84ugKrXM2Lzm2Te+eHlxv/gFHgRP1SDKng4J5bsO2iXaYqaI25s2QOa2wGorgTm /LwQ== X-Gm-Message-State: AD7BkJJ3opP0rn3rndV9vW0kwK/DDXyPNyvH8R3Qi/i3IPSZ3qPNze1e4qJAvcraT7143A== X-Received: by 10.194.134.134 with SMTP id pk6mr24264668wjb.176.1457960209754; Mon, 14 Mar 2016 05:56:49 -0700 (PDT) Original-Received: from phst2.muc.corp.google.com ([2a00:79e0:15:4:3803:4cd5:362f:2ee2]) by smtp.gmail.com with ESMTPSA id c144sm16043917wmd.12.2016.03.14.05.56.48 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 14 Mar 2016 05:56:49 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:114889 Archived-At: `xterm-mouse-mode' sends \e[?1005h to enable UTF-8 mouse coordinates, but it never checks that the terminal actually supports that. Then `xterm-mouse--read-utf8-char' reads an UTF-8 sequence without checking that the terminal actually sent one. On terminals that don't support UTF-8 coordinates (such as Chromium's hterm) this leads to garbage if any mouse coordinate is larger than 127. For example, when clicking in the right part of the terminal in hterm, the menu opens and the following is shown in lossage: ESC [ M SPC \237 F ESC [ M # \237 F [tmm-menubar-mouse] Instead, this should have been interpreted as two events with single-byte mouse coordinates. I'd suggest the following (and will happily provide patches if accepted): - Don't enable UTF-8 coordinates at all. It is too hard to figure out whether they are enabled. Rather, err on the safe side and only use single-byte coordinates. (The superior SGR mode, which doesn't suffer from this problem, should remain enabled.) - In `xterm-mouse--read-number-from-terminal', specify a very short timeout. The terminal will always write the entire escape sequence as a unit, so waiting only increases the chance to accidentially read unrelated events. - As an optimization, provide a `read-byte' function written in C that reads a single byte without taking the current terminal encoding into account. In GNU Emacs 25.0.92.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8) of 2016-03-14 built on REDACTED Repository revision: 80ec484ac83e6965a843dabf766ade057ee1bc6a Windowing system distributor 'The X.Org Foundation', version 11.0.11501000 System Description: Ubuntu 14.04 LTS Configured features: XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GCONF GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message dired format-spec rfc822 mml mml-sec epg epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode easymenu cl-loaddefs pcase cl-lib mail-prsvr mail-utils time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind inotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 88738 7446) (symbols 48 19932 0) (miscs 40 463 186) (strings 32 14918 4643) (string-bytes 1 445677) (vectors 16 12226) (vector-slots 8 442799 4664) (floats 8 164 18) (intervals 56 206 0) (buffers 976 12) (heap 1024 30327 1014)) --=20 Google Germany GmbH Erika-Mann-Stra=C3=9Fe 33 80636 M=C3=BCnchen Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Gesch=C3=A4ftsf=C3=BChrer: Matthew Scott Sucherman, Paul Terence Manicle Diese E-Mail ist vertraulich. Wenn Sie nicht der richtige Adressat sind, leiten Sie diese bitte nicht weiter, informieren Sie den Absender und l=C3= =B6schen Sie die E-Mail und alle Anh=C3=A4nge. Vielen Dank. This e-mail is confidential. If you are not the right addressee please do = not forward it, please inform the sender, and please erase this e-mail including any attachments. Thanks.