* bug#10642: xt-mouse: Support extended coordinates
@ 2012-01-29 16:27 Egmont Koblinger
2012-07-14 15:46 ` Chong Yidong
0 siblings, 1 reply; 3+ messages in thread
From: Egmont Koblinger @ 2012-01-29 16:27 UTC (permalink / raw
To: 10642
[-- 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 --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#10642: xt-mouse: Support extended coordinates
2012-01-29 16:27 bug#10642: xt-mouse: Support extended coordinates Egmont Koblinger
@ 2012-07-14 15:46 ` Chong Yidong
2012-08-06 20:38 ` Egmont Koblinger
0 siblings, 1 reply; 3+ messages in thread
From: Chong Yidong @ 2012-07-14 15:46 UTC (permalink / raw
To: Egmont Koblinger; +Cc: 10642
Egmont Koblinger <egmont@gmail.com> writes:
> 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.
Thanks; the detailed information in your report was very useful. I've
implemented the 1006 protocol handling, and committed it to trunk.
The code assumes that if the terminal does not support 1006 mode,
sending the \e[?1006h sequence is a no-op, and mouse click events are
received using the old protocol. We look for both \e[M and \e[< events
and handle them. This seems to work on XTerms supporting 1006 mode
(tested with xterm-281) as well as older ttys (tested with xterm-271 and
xfce4-terminal 0.4.8).
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#10642: xt-mouse: Support extended coordinates
2012-07-14 15:46 ` Chong Yidong
@ 2012-08-06 20:38 ` Egmont Koblinger
0 siblings, 0 replies; 3+ messages in thread
From: Egmont Koblinger @ 2012-08-06 20:38 UTC (permalink / raw
To: Chong Yidong; +Cc: 10642
[-- Attachment #1: Type: text/plain, Size: 1373 bytes --]
Thanks very much, Chong!
Just for the record, I've implemented the 1006 support to Gnome-Terminal
and Konsole; I hope they will accept my patches and this 1006 extension
will become quite mainstream across terminal emulators.
https://bugzilla.gnome.org/show_bug.cgi?id=681329
https://bugs.kde.org/show_bug.cgi?id=304686
thanks,
egmont
On Sat, Jul 14, 2012 at 5:46 PM, Chong Yidong <cyd@gnu.org> wrote:
> Egmont Koblinger <egmont@gmail.com> writes:
>
> > 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.
>
> Thanks; the detailed information in your report was very useful. I've
> implemented the 1006 protocol handling, and committed it to trunk.
>
> The code assumes that if the terminal does not support 1006 mode,
> sending the \e[?1006h sequence is a no-op, and mouse click events are
> received using the old protocol. We look for both \e[M and \e[< events
> and handle them. This seems to work on XTerms supporting 1006 mode
> (tested with xterm-281) as well as older ttys (tested with xterm-271 and
> xfce4-terminal 0.4.8).
>
[-- Attachment #2: Type: text/html, Size: 1906 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-08-06 20:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-29 16:27 bug#10642: xt-mouse: Support extended coordinates Egmont Koblinger
2012-07-14 15:46 ` Chong Yidong
2012-08-06 20:38 ` Egmont Koblinger
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.