From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.bugs Subject: bug#24420: 25.1.50; Work around terminal differences for bracketed-paste/mouse-2 Date: Wed, 14 Sep 2016 20:05:21 +0000 Message-ID: References: <8737l2pbue.fsf@cochranmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7ba97a1063bfeb053c7d40b2 X-Trace: blaine.gmane.org 1473883590 31385 195.159.176.226 (14 Sep 2016 20:06:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 14 Sep 2016 20:06:30 +0000 (UTC) Cc: 24420@debbugs.gnu.org To: Robert Cochran Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 14 22:06:23 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkGRj-0006Rm-GI for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Sep 2016 22:06:15 +0200 Original-Received: from localhost ([::1]:58496 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkGRh-00006P-Pw for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Sep 2016 16:06:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35002) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkGRb-00006G-5z for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 16:06:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkGRW-0004bk-PW for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 16:06:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33905) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkGRW-0004bb-JV for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 16:06:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bkGRW-0007Zh-Dv for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 16:06:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Sep 2016 20:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24420 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24420-submit@debbugs.gnu.org id=B24420.147388354129084 (code B ref 24420); Wed, 14 Sep 2016 20:06:02 +0000 Original-Received: (at 24420) by debbugs.gnu.org; 14 Sep 2016 20:05:41 +0000 Original-Received: from localhost ([127.0.0.1]:59850 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkGRA-0007Z2-TP for submit@debbugs.gnu.org; Wed, 14 Sep 2016 16:05:41 -0400 Original-Received: from mail-wm0-f51.google.com ([74.125.82.51]:35289) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkGR8-0007Ym-3X for 24420@debbugs.gnu.org; Wed, 14 Sep 2016 16:05:38 -0400 Original-Received: by mail-wm0-f51.google.com with SMTP id i130so66485236wmf.0 for <24420@debbugs.gnu.org>; Wed, 14 Sep 2016 13:05:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vmzECie9PMb9KnKbQUnLCWvb105BczHXGCbzxS3HIcE=; b=Lh2iNrnF2NxFCaemKQbuE0dcSLrG6yNwMorDbzG0wanp21Xf6DV+FiDKrXZ13N2bvu GQZPEk/cnqPFfdVplNCAXPoefSNKr15QChfBGbNHswXHB+Pf76osk8MqCDZLGV4jXU6o Vt0lVBjP3bSeXljDIbPxHvkOJdkt7AilZQ3ppgQ9CiqCLW/mYsnzh52qGGnzTTAOXLWi A3t5Yr7oKI3nBzlW3hAeEkHfU+uqx9/vafgquIhRJHG8Xh1iRVOvZPMh/l1VK938Za8g W38wvTg5zzYySBpaAQeN+8Nqakj+1u1vreRoufisgeRFKgZWxZfIXJROgM/8X0iZ5O/n wu4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vmzECie9PMb9KnKbQUnLCWvb105BczHXGCbzxS3HIcE=; b=jh04OReiMC283HBxBXnobGfJqAAlY4p4dDdMvfUv6FmIOjEHjyGJEVuimWEOX1CQQ7 CtFt+YvtCHO7JiViOuKBfer0l5WDw9VtC5evcN9UpPdm+tBrH7D1TN25xMxJiBcdBlco st2uYtERUJ/ddJyu4bRqSqKHw1foeGRuIoI39v/mOeTaQNJ8M1ocf2s1f97eVi3iAv9E ldXSQuVUcWprFidWKV3dAso6N65RlVcTADKYBZwOJt8C/3DXy69g7dNL4skoM2r+rS8q D0T2IrXNeNnN7M3CivWtIwU7bKlJ5QIbiBYiRn/U7TFMGIVJzj/El/FRA6lK5JDEBMiX +RVQ== X-Gm-Message-State: AE9vXwNiAq99oWpv3PfmFygmHGDCSfwxZE6i3K3dKxvQjTAk3/wtJyLu+x+6n7btGYKNYHBK9PCVurp9Q9Rxng== X-Received: by 10.194.184.39 with SMTP id er7mr4381476wjc.159.1473883532407; Wed, 14 Sep 2016 13:05:32 -0700 (PDT) In-Reply-To: <8737l2pbue.fsf@cochranmail.com> 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" Xref: news.gmane.org gmane.emacs.bugs:123313 Archived-At: --047d7ba97a1063bfeb053c7d40b2 Content-Type: text/plain; charset=UTF-8 Robert Cochran schrieb am Mi., 14. Sep. 2016 um 20:37 Uhr: > Philipp Stephani writes: > > > There are several terminals that announce themselves as XTerm and > > partially implement the XTerm control sequences > > (http://invisible-island.net/xterm/ctlseqs/ctlseqs.html), but have some > > slightly different behavior. > > That sounds like breakage waiting to happen. Maybe I'm not entirely > familiar with how things are done in terminal-emulator-land, but why > would you declare yourself as an XTerm if you only partially implement > or differ from the real thing? For the same reason that every web browser on the planet declares itself as "Mozilla". Identification strings simply don't work. how do you communicate the advanced features (like mouse support)? Is it > simply that it's there if a terminal claims to be an xterm? Or is there > a real query method for those things? > That's not really possible. Basically Emacs tries to enable all features and assumes the terminal emulator simply ignores escape sequences it doesn't understand. > > > I've tried out XTerm, HTerm, and gnome-terminal, and found the > > following behavior differences: > > > > - XTerm sends xterm-paste (ESC [ 200~ ... ESC [ 201~) if > > xterm-mouse-mode is disabled. If xterm-mouse-mode is enabled, it > > sends down-mouse-2 + up-mouse-2 using SGR coordinates (ESC [<1;x;yM > > ESC [<1;x;ym), which gets translated to mouse-yank-primary. > > > > - Gnome Terminal sends xterm-paste if xterm-mouse-mode is disabled. If > > xterm-mouse-mode is enabled, it only sends down-mouse-2 using SGR > > coordinates, which is ignored by Emacs. > > > > - HTerm doesn't use bracketed paste mode if xterm-mouse-mode is disabled > > (i.e. pasted text gets inserted using individual > > self-insert-commands). If xterm-mouse-mode is enabled, it uses both > > (!) down-mouse-2 + down-mouse-up (using basic coordinates) and then a > > bracketed paste. > > > > The HTerm and Gnome-Terminal behaviors are probably bugs, and I'll try > > to get them fixed. However, maybe we want to work around these issues > > on the Emacs side, e.g. by not requiring an up-mouse-2 if > > xterm-mouse-mode is enabled. > > I could go either way on this one... Emacs maybe ought not to be so > choosy about what it gets from a control character standpoint, but how > relatively difficuly would it be to fix the emulators to do both up and > down? That way both flavors of program are satisfied: the ones looking > for down-only get their event, and those looking for both get both. > > Fixing gnome-terminal would be preferred, yes, but old (unfixed) versions tend to stick around for years. With HTerm it's a bit different: arguably HTerm's behavior is better than XTerm's, because with XTerm you can't paste any more once you enable extended mouse mode. --047d7ba97a1063bfeb053c7d40b2 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


Robert= Cochran <robert-emacs@c= ochranmail.com> schrieb am Mi., 14. Sep. 2016 um 20:37=C2=A0Uhr:
=
Philipp Stephani <p.stephani2@g= mail.com> writes:

> There are several terminals that announce themselves as XTerm and
> partially implement the XTerm control sequences
> (http://invisible-isl= and.net/xterm/ctlseqs/ctlseqs.html), but have some
> slightly different behavior.

That sounds like breakage waiting to happen. Maybe I'm not entirely
familiar with how things are done in terminal-emulator-land, but why
would you declare yourself as an XTerm if you only partially implement
or differ from the real thing?

For the same= reason that every web browser on the planet declares itself as "Mozil= la". Identification strings simply don't work.
=C2=A0

how do you communicate the= advanced features (like mouse support)? Is it
simply that it's there if a terminal claims to be an xterm? Or is there=
a real query method for those things?
<= div>
That's not really possible. Basically Emacs tries to= enable all features and assumes the terminal emulator simply ignores escap= e sequences it doesn't understand.
=C2=A0

> I've tried out XTerm, HTerm, and gnome-terminal, and found the
> following behavior differences:
>
> - XTerm sends xterm-paste (ESC [ 200~ ... ESC [ 201~) if
>=C2=A0 =C2=A0xterm-mouse-mode is disabled.=C2=A0 If xterm-mouse-mode is= enabled, it
>=C2=A0 =C2=A0sends down-mouse-2 + up-mouse-2 using SGR coordinates (ESC= [<1;x;yM
>=C2=A0 =C2=A0ESC [<1;x;ym), which gets translated to mouse-yank-prim= ary.
>
> - Gnome Terminal sends xterm-paste if xterm-mouse-mode is disabled.=C2= =A0 If
>=C2=A0 =C2=A0xterm-mouse-mode is enabled, it only sends down-mouse-2 us= ing SGR
>=C2=A0 =C2=A0coordinates, which is ignored by Emacs.
>
> - HTerm doesn't use bracketed paste mode if xterm-mouse-mode is di= sabled
>=C2=A0 =C2=A0(i.e. pasted text gets inserted using individual
>=C2=A0 =C2=A0self-insert-commands).=C2=A0 If xterm-mouse-mode is enable= d, it uses both
>=C2=A0 =C2=A0(!) down-mouse-2 + down-mouse-up (using basic coordinates)= and then a
>=C2=A0 =C2=A0bracketed paste.
>
> The HTerm and Gnome-Terminal behaviors are probably bugs, and I'll= try
> to get them fixed.=C2=A0 However, maybe we want to work around these i= ssues
> on the Emacs side, e.g. by not requiring an up-mouse-2 if
> xterm-mouse-mode is enabled.

I could go either way on this one... Emacs maybe ought not to be so
choosy about what it gets from a control character standpoint, but how
relatively difficuly would it be to fix the emulators to do both up and
down? That way both flavors of program are satisfied: the ones looking
for down-only get their event, and those looking for both get both.


Fixing gnome-termi= nal would be preferred, yes, but old (unfixed) versions tend to stick aroun= d for years.
With HTerm it's a bit different: arguably HTerm&= #39;s behavior is better than XTerm's, because with XTerm you can't= paste any more once you enable extended mouse mode.=C2=A0
--047d7ba97a1063bfeb053c7d40b2--