unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Egmont Koblinger <egmont@gmail.com>
To: 10642@debbugs.gnu.org
Subject: bug#10642: xt-mouse: Support extended coordinates
Date: Sun, 29 Jan 2012 17:27:43 +0100	[thread overview]
Message-ID: <CAGWcZkLk4DRhjW7ukxsgMTw6vAVkarN6K-9tVTxBy3Lwvekmmw@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 3765 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 4224 bytes --]

             reply	other threads:[~2012-01-29 16:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-29 16:27 Egmont Koblinger [this message]
2012-07-14 15:46 ` bug#10642: xt-mouse: Support extended coordinates Chong Yidong
2012-08-06 20:38   ` Egmont Koblinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGWcZkLk4DRhjW7ukxsgMTw6vAVkarN6K-9tVTxBy3Lwvekmmw@mail.gmail.com \
    --to=egmont@gmail.com \
    --cc=10642@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).