From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27201 invoked by alias); 5 Jun 2015 13:47:02 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35393 Received: (qmail 1304 invoked from network); 5 Jun 2015 13:46:59 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1433511608; bh=DbHA02vyCxJrM0cANPl5Du5Q1jJt1k+k4qxBmy8b3RQ=; h=cc:In-reply-to:From:References:To:Subject:Date:From:Subject; b=E6TJIXhBiPydRJc2oyIodskgSLbFPciq5Q4O9oNwdqNHbtaJCRHVGDlyxoNt31l6EDu+lkntF7VBDIuAGCNSgHf+OwQidIz9eGeq2Pketp28cqqEyBy2GGXyVzKeMdQa2RRoZSFm7ssekP7CCtn6YGmVaLe7tCoLFT2KVTyQ1d5CS52RgguawKaQ22lJXzvvdvsbN8YLXT8hrL4I/hVzWZbmbs1NWPKDMZMWuj45BMidUayTH7IkctmxkKx3+Hh0jSO3Xvtz9cOfNC5u7+eQIJASTFj42pNaq7IT+zuMdsqGlZ+7oSZzSLxNwxtSHnbT7gdI+dllBNr+Xls8L5YVSg== X-Yahoo-Newman-Id: 950640.72866.bm@smtp124.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: h3WjMoEVM1nQy37Qiwn4piK6oi8L4AiSffX44Wgrp7ajqpn kXS_rckxwQcOdKlfyj.24lmLebmPhly2Mjlz4UJyoD4pRe.U9nSCbGTdu5AU sy4UzSldTI4YTjOI91BHeDyGiihSBOHial0wAb0bllvlWPKcpW6Vd3KbGFJ3 YlTo3xE6z6CRlW_UZBc6qK4wT_QCgg8rUw8h9lO5yzJ9L_J6lZAexpM1CpQc yoHmybWuOCovWeLdO0NFf9H6XTvlqr5XZYBiUxPmPWuxPQwB04EnR1bD0jhh tKOMiqLuz_KIuBPucf_C4OixRbfX5Fc3MmPyE.nr4YEeeaqO7gbaguNjXjOO ozuPzAA5FpgaG5hJq97xwH4fVKZGgj2BXSkYBLGfsteAZ3tD4oiBCpLhbsdH NfDy0mM3VP9UaE5kRI39CyhhPUe0cNfSUCfzV_.TZcHTy53sJJG6AGZL6u9J CoZDZz7fY.CqRYE9P4Gy99AIwgA3w2EfQdRzzeuy2xuzeqShnqIHpYdJoxdR 0C_vhbTP7PQe3M996fGNLd4Q0mXnvoMa5 X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- cc: zsh-workers@zsh.org In-reply-to: From: Oliver Kiddle References: <55677AF5.50709@thequod.de> <27004.1433345491@thecus.kiddle.eu> To: Yuri D'Elia Subject: Re: bracketed paste mode in xterm and urxvt MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3097.1433511607.1@thecus.kiddle.eu> Date: Fri, 05 Jun 2015 15:40:07 +0200 Message-ID: <3098.1433511607@thecus.kiddle.eu> 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