zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Yuri D'Elia <wavexx@thregr.org>
Cc: zsh-workers@zsh.org
Subject: Re: bracketed paste mode in xterm and urxvt
Date: Fri, 05 Jun 2015 15:40:07 +0200	[thread overview]
Message-ID: <3098.1433511607@thecus.kiddle.eu> (raw)
In-Reply-To: <mkrus3$kdi$1@ger.gmane.org>

Yuri D'Elia wrote:
> Actually, with this, couldn't we just disable isig while inserting the
> characters?

Unfortunately not. As Stephane indicated, the string is written in one
go. The terminal driver sees and handles the interrupt character before
zsh has had the chance to interpret the start sequence. It's a feature
that an interrupt doesn't rely on the user program having emptied the
input buffer. It might be possible to do something from a clever SIGINT
handler but I doubt that could be especially reliable. I think I'd
rather have xterm/urxvt strip ^C (plus a few others) and know that I
shouldn't expect pasting to be safe if I use something weird. Unless
someone has some other ideas?

> > etc (I actually append the strings to PS1/PS2/POSTEDIT). It'd certainly
> > possible to add a setopt option to zsh to automatically output the
> > enable/disable strings for bracketed paste. Testing a few ancient
> > terminals (xterm and dtterm on Solaris 10), they seem to have no ill
> > effect. Perhaps it'd be better to apply some sort of heuristics based on
> > terminfo, however. Any thoughts on this?
> 
> I guess we can't use terminfo has no feature for this, right?

Not directly but we might discern some indication from it as to whether
it will regard the sequence as being an escape sequence.

The important thing is that outputting \e[?2004h is harmless. Every
terminal I've tried absorbs the string rather than printing some or all
of it so they presumably recognise \e[? four digit number h as being an
unknown escape sequence. Barring it having some other meaning, that's
all we need. Taking the output of this:
  printf '%s %q\n' ${(kv)terminfo[(R)*[0-9](#c4)[hl]]}
Shows smcup and rmcup as containing that pattern for xterm, urxvt and
screen as $TERM. libvte based things use "xterm" for $TERM. Does anyone
know of any other terminal that may be relevant, perhaps on a mobile
phone? What about putty?

> > What behaviour would you want in vi-mode? What about with the region
> > active? Replacing the region might make sense but isn't really what
> > emacs or vim do.
> 
> emacs disables the transient selection when pasting (which is inserted
> on the current cursor position). For vi I'm not sure what I would
> like... maybe the same. You have to enter insert mode normally, so it
> would make it identical in behavior. Maybe gvim is different?

Replacing the selection is probably the most useful thing. Trying
editors like gedit and nedit, pasting the secondary selection will
replace the currently highlighted selection. GUI emacs is a bit the
odd-one-out, not even grabbing the X selection but it is perhaps trying
to be compatble with emacs run from a tty by default. A p command in vim
does replace the selection while a middle-mouse paste uses the mouse
position which isn't comparable.

Oliver


  reply	other threads:[~2015-06-05 13:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <BANLkTikh_-+L2W5=Yfu7h7iAe5CcpP6fxw@mail.gmail.com>
     [not found] ` <CAFOazAOfk=Sq-smkMGzJKO4b7jMb_1_m4vXXn8twoVA2wV55YA@mail.gmail.com>
     [not found]   ` <55677AF5.50709@thequod.de>
     [not found]     ` <mk9dc0$p0$1@ger.gmane.org>
     [not found]       ` <CABZhJg_5p8BLbq82s_wVtsPdD5hVtk-cPg6fNxzbSs4Vg00SOw@mail.gmail.com>
     [not found]         ` <mkmjfu$3h0$1@ger.gmane.org>
     [not found]           ` <CAHYJk3T3dVdN5qDMecPAH_ALLBYNntW0QVdPMh50Lo_ULeWP6w__21110.9288772152$1433333265$gmane$org@mail.gmail.com>
2015-06-03 12:43             ` Stephane Chazelas
2015-06-03 15:31       ` Oliver Kiddle
2015-06-03 20:42         ` Stephane Chazelas
2015-06-03 23:48           ` Oliver Kiddle
2015-06-04  7:15             ` Stephane Chazelas
2015-06-05 10:49         ` Yuri D'Elia
2015-06-05 13:40           ` Oliver Kiddle [this message]
2015-06-05 14:35             ` Yuri D'Elia
2015-06-10  0:28               ` Oliver Kiddle
2015-06-10  4:38                 ` Bart Schaefer
2015-06-15 22:11                   ` Oliver Kiddle
2015-06-15 23:09                     ` Mikael Magnusson
2015-06-16  0:20                     ` Bart Schaefer
2015-06-16 17:12                       ` Oliver Kiddle
2015-06-16 20:26                         ` Bart Schaefer
2015-06-17 10:45                           ` Oliver Kiddle
2015-06-17 15:04                             ` Bart Schaefer
2015-06-10  9:44                 ` Yuri D'Elia

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

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

  git send-email \
    --in-reply-to=3098.1433511607@thecus.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --cc=wavexx@thregr.org \
    --cc=zsh-workers@zsh.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.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).