From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Egmont Koblinger Newsgroups: gmane.emacs.bugs Subject: bug#10642: xt-mouse: Support extended coordinates Date: Sun, 29 Jan 2012 17:27:43 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0016e6d5669cfd093404b7ad379e X-Trace: dough.gmane.org 1327873823 27107 80.91.229.3 (29 Jan 2012 21:50:23 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 29 Jan 2012 21:50:23 +0000 (UTC) To: 10642@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 29 22:50:22 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Rrcdi-00073V-3N for geb-bug-gnu-emacs@m.gmane.org; Sun, 29 Jan 2012 22:50:22 +0100 Original-Received: from localhost ([::1]:58468 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rrcdh-0004xP-DD for geb-bug-gnu-emacs@m.gmane.org; Sun, 29 Jan 2012 16:50:21 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:39904) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RraRs-0006sA-Sf for bug-gnu-emacs@gnu.org; Sun, 29 Jan 2012 14:30:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RraRq-0002y5-M9 for bug-gnu-emacs@gnu.org; Sun, 29 Jan 2012 14:30:00 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RraRq-0002y0-5C for bug-gnu-emacs@gnu.org; Sun, 29 Jan 2012 14:29:58 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1RraRu-0007pV-SI for bug-gnu-emacs@gnu.org; Sun, 29 Jan 2012 14:30:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Egmont Koblinger Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 29 Jan 2012 19:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 10642 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.132786536230000 (code B ref -1); Sun, 29 Jan 2012 19:30:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Jan 2012 19:29:22 +0000 Original-Received: from localhost ([127.0.0.1]:44083 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RraRF-0007no-8U for submit@debbugs.gnu.org; Sun, 29 Jan 2012 14:29:22 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:44163) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RrXcP-0003Xh-KR for submit@debbugs.gnu.org; Sun, 29 Jan 2012 11:28:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RrXcD-0004ZY-OF for submit@debbugs.gnu.org; Sun, 29 Jan 2012 11:28:31 -0500 Original-Received: from lists.gnu.org ([140.186.70.17]:53493) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrXcD-0004ZQ-LL for submit@debbugs.gnu.org; Sun, 29 Jan 2012 11:28:29 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:37579) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrXcB-0001qC-EU for bug-gnu-emacs@gnu.org; Sun, 29 Jan 2012 11:28:28 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RrXc9-0004Yw-NO for bug-gnu-emacs@gnu.org; Sun, 29 Jan 2012 11:28:27 -0500 Original-Received: from mail-we0-f169.google.com ([74.125.82.169]:46056) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrXc9-0004YQ-DU for bug-gnu-emacs@gnu.org; Sun, 29 Jan 2012 11:28:25 -0500 Original-Received: by wera13 with SMTP id a13so3124093wer.0 for ; Sun, 29 Jan 2012 08:28:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; bh=wJWKSku7EtoO7JZSs3+fOJ6GVhOrPq+SFKptqYd1n8k=; b=KhuBH/5VyhvxiN/7HVI53FYsBterdcPJGXgpgW+N7A3IOmjTAKnSiTjouPKBeuuiYt tCLRr+uchmnN7Eddnyo6iSTMAYRDyAKrjpHG3HWQzafsufgj5omqx1K+pBlyb2em2otT 1l0VN1cF1ODfQgMFrlp9HSQO8BkG6Gt3UUwSU= Original-Received: by 10.216.131.21 with SMTP id l21mr5885743wei.39.1327854503397; Sun, 29 Jan 2012 08:28:23 -0800 (PST) Original-Received: by 10.216.10.146 with HTTP; Sun, 29 Jan 2012 08:27:43 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Sun, 29 Jan 2012 14:29:20 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-Mailman-Approved-At: Sun, 29 Jan 2012 16:50:19 -0500 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:56205 Archived-At: --0016e6d5669cfd093404b7ad379e Content-Type: text/plain; charset=UTF-8 Hi, When running in terminal, Emacs only supports mouse clicks up to column or row 223, due to a limitation in the original mouse protocol. However, there is an extension (well, unfortunately, there are a couple of extensions) to overcome this limit. This request is hereby for emacs to implement one of them, so that mouse click works on arbitrary coordinates. The first of such extensions, implemented originally by xterm, is the "1005" mode. It is horribly broken, it breaks mouse handling of applications that implement this extension but run on a terminal that doesn't. So long story short: please don't even consider implementing this mode. The next such extension, to overcome some problems with this mode was implemented originall by rxvt-unicode, is the "1015" extension. Currently it is supported by quite a few terminal emulators, namely rxvt-unicode 9.10, iterm2 1.0 (added by mainstream author), xterm 277, gnome-terminal (vte 0.31) and konsole git HEAD (to become 4.9) -- for the last three the support was added by me. For technical details about these two extensions, see the first comment of http://www.midnight-commander.org/ticket/2662 . Since writing that ticket, another extension, the "1006" mode was invented by xterm's author, appeared in xterm-277, see the source of that for details. In spirit it's pretty much like 1015 (e.g. avoid binary and spells out coordinates in decimal) but addresses some issues with 1015. For some discussions about this 1006 extension versus 1015, see http://vim.1045645.n5.nabble.com/Fwd-Mouse-reporting-and-new-standards-td3378370.html(warning: multiple pages). I am new to emacs's source and new to lisp, so probably I won't come up with a patch myself. However, looking at the code, I have a feeling that adding support for 1006 might be easier than adding support for 1015. This is because 1006 begins with \e[< (and even though theoretically other non-mouse events might also start with this escape, it's unlikely that emacs will ever be interested in those), so in xt-mouse.el you can define-key for \e[< and do all the rest in this file. 1015, due to lack of a unique prefix, requires a quite different parsing flow, and the fix would probably involve touching the C code, too. That's my guess only. Due to much wider adoptation by current terminals, I recommend that you implement the 1015 extension if it's feasible. If not, then please implement the 1006 extension, and I'm happy to work in getting this extension into as many terminal emulators as possible. In either case, the good news is that no matter which of 1006 or 1015 you choose, it won't break the behavior on terminals that don't support them. Just ask the terminal to enable the extension by outputting "\e[?1000h\e[?1015h" or "\e[?1000h\e[?1006h", disable similarly when exiting (e.g. "\e[?1006l\e[?1000l"). If the underlying terminal supports the extension, it will report coordinates in the new format, but if doesn't then it will report coordinates in the old format. These two formats are distinguishable (except for the 1005 mode, that's why that extension is out of question). Just for the record: midnight commander >= 4.8.1 already supports the 1015 extension and autodetects it, no configuration is required from the user. Vim >= 7.3.353 (>= 7.3.405 if running in xterm) also supports this extension, but you need to have ":set ttymouse=urxvt" in your .vimrc, so it's not autodetected; the autodetect possibility was discussed in the thread linked above. Let me know if there's anything I can help with (apart from writing the actual patch :)). The overall goal is hopefully to make clicks on arbitrary positions just work out of the box, without the user having to do anything. thanks a lot, egmont --0016e6d5669cfd093404b7ad379e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi,

When running in terminal, Emacs only supports mouse clicks up to= column or row 223, due to a limitation in the original mouse protocol. How= ever, there is an extension (well, unfortunately, there are a couple of ext= ensions) to overcome this limit.

This request is hereby for emacs to implement one of them, so that mous= e click works on arbitrary coordinates.

The first of such extensions= , implemented originally by xterm, is the "1005" mode.=C2=A0 It i= s horribly broken, it breaks mouse handling of applications that implement = this extension but run on a terminal that doesn't.=C2=A0 So long story = short: please don't even consider implementing this mode.

The next such extension, to overcome some problems with this mode was i= mplemented originall by rxvt-unicode, is the "1015" extension.=C2= =A0 Currently it is supported by quite a few terminal emulators, namely rxv= t-unicode 9.10, iterm2 1.0 (added by mainstream author), xterm 277, gnome-t= erminal (vte 0.31) and konsole git HEAD (to become 4.9) -- for the last thr= ee the support was added by me.

For technical details about these two extensions, see the first comment= of http://www.mi= dnight-commander.org/ticket/2662 .

Since writing that ticket, an= other extension, the "1006" mode was invented by xterm's auth= or, appeared in xterm-277, see the source of that for details.=C2=A0 In spi= rit it's pretty much like 1015 (e.g. avoid binary and spells out coordi= nates in decimal) but addresses some issues with 1015.

For some discussions about this 1006 extension versus 1015, see http://vim.1045645.n5.nabble.com/Fwd-Mouse-reporting-and-ne= w-standards-td3378370.html (warning: multiple pages).

I am new to emacs's source and new to lisp, so probably I won't= come up with a patch myself.=C2=A0 However, looking at the code, I have a = feeling that adding support for 1006 might be easier than adding support fo= r 1015.=C2=A0 This is because 1006 begins with \e[< (and even though the= oretically other non-mouse events might also start with this escape, it'= ;s unlikely that emacs will ever be interested in those), so in xt-mouse.el= you can define-key for \e[< and do all the rest in this file.=C2=A0 101= 5, due to lack of a unique prefix, requires a quite different parsing flow,= and the fix would probably involve touching the C code, too.=C2=A0 That= 9;s my guess only.

Due to much wider adoptation by current terminals, I recommend that you= implement the 1015 extension if it's feasible.=C2=A0 If not, then plea= se implement the 1006 extension, and I'm happy to work in getting this = extension into as many terminal emulators as possible.

In either case, the good news is that no matter which of 1006 or 1015 y= ou choose, it won't break the behavior on terminals that don't supp= ort them.=C2=A0 Just ask the terminal to enable the extension by outputting= "\e[?1000h\e[?1015h" or "\e[?1000h\e[?1006h", disable = similarly when exiting (e.g. "\e[?1006l\e[?1000l").=C2=A0 If the = underlying terminal supports the extension, it will report coordinates in t= he new format, but if doesn't then it will report coordinates in the ol= d format.=C2=A0 These two formats are distinguishable (except for the 1005 = mode, that's why that extension is out of question).

Just for the record: midnight commander >=3D 4.8.1 already supports = the 1015 extension and autodetects it, no configuration is required from th= e user.=C2=A0 Vim >=3D 7.3.353 (>=3D 7.3.405 if running in xterm) als= o supports this extension, but you need to have ":set ttymouse=3Durxvt= " in your .vimrc, so it's not autodetected; the autodetect possibi= lity was discussed in the thread linked above.

Let me know if there's anything I can help with (apart from writing= the actual patch :)).=C2=A0 The overall goal is hopefully to make clicks o= n arbitrary positions just work out of the box, without the user having to = do anything.


thanks a lot,
egmont

--0016e6d5669cfd093404b7ad379e--