Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16220

Re: pasting in bracketed-paste mode breaks reverse-i-search

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From gentoo_eshoes@tutanota.com
Newsgroups gnu.bash.bug
Subject Re: pasting in bracketed-paste mode breaks reverse-i-search
Date Tue, 21 Apr 2020 22:25:57 +0200 (CEST)
Lines 73
Approved bug-bash@gnu.org
Message-ID <mailman.909.1587500763.3066.bug-bash@gnu.org> (permalink)
References <M5PMSNi--3-2@tutanota.com> <62817207-4c7b-491e-2c5a-a57128e04b88@case.edu> <M5SqQR7--3-2@tutanota.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Trace usenet.stanford.edu 1587500763 3577 209.51.188.17 (21 Apr 2020 20:26:03 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash@gnu.org, chet.ramey@case.edu
To Chet Ramey <chet.ramey@case.edu>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1587500757; s=s1; d=tutanota.com; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Cc:Cc:Date:Date:In-Reply-To:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:References:Sender; bh=JgGW9WjO+wf1/m9juqe8xoKwfC0bOsqH3QWYH1AFGVo=; b=2f2XAUG7zSOV/pFYvcdc8gcFWPxncB7Epopd4TZ4pYCzrb8g1QvUw0y4vYw5Zjq5 Wp/pdZGnRYY+DWFKZ3G6/2cyb8FsJiOtyTtXm1BAF9teT3CfBUHXuIkBFhwModvIKtV G5ELMt3GIJnLxRm9ci+6f/crHGK3AXozm4x0bOd+ZhPtGS6+j3dpVPhFDNgo7IJ2See LSBY8u3drRPHUm8kNXmcizaRQqLQa9A1EBsEj0YgVJ+WrX+soLCsrcZc0BkS4QYRQH+ P1fifweE7ItAu2XgA3lwa/8A4u3l6xlbTOxDirCQnq6diuc7UDXyXIOoJ32NIVDtDJz 8gdYYwdeGQ==
In-Reply-To <62817207-4c7b-491e-2c5a-a57128e04b88@case.edu>
Received-SPF pass client-ip=81.3.6.162; envelope-from=gentoo_eshoes@tutanota.com; helo=w1.tutanota.de
X-detected-operating-system by eggs.gnu.org: First seen = 2020/04/21 16:25:57
X-ACL-Warn Detected OS = Linux 2.2.x-3.x [generic] [fuzzy]
X-Received-From 81.3.6.162
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <M5SqQR7--3-2@tutanota.com>
X-Mailman-Original-References <M5PMSNi--3-2@tutanota.com> <62817207-4c7b-491e-2c5a-a57128e04b88@case.edu>
Xref csiph.com gnu.bash.bug:16220

Show key headers only | View raw




Apr 21, 2020, 16:14 by chet.ramey@case.edu:

> On 4/20/20 9:32 PM, gentoo_eshoes--- via Bug reports for the GNU Bourne
> Again SHell wrote:
>
>> pasting while in reverse-i-search undoes it
>> Repeat-By:
>> $ bind 'set enable-bracketed-paste on'
>> select character 'c' with the mouse, so it can be pasted via pressing MMB or shift+insert
>> press Ctrl+R to enter (reverse-i-search)`': 
>> paste, (either by pressing MMB or shift+insert)
>> the reverse-i-search prompt goes away and you're back to regular prompt, having just 'c' pasted there: $ c
>>
>
> It's the ESC prefix. You can use it if you remove ESC from the list of
> characters that terminate an incremental search. The problem is that most
> of the key sequences that begin with ESC (e.g., arrow keys) are intended to
> terminate the isearch and use the ESC as the first character of a key
> sequence. You have to look farther ahead in the input stream than
> incremental search presently does to differentiate between an ESC-prefixed
> key sequence you want to use for searching and one you want to terminate
> the search and use as a command.
>
Did you mean to say that bracketed-mode pastes ESC, perhaps as a way to highlight(ie. that white background) ?
interesting

  static char * const default_isearch_terminators = "\033\012";                                                  
ESC and newline(ie. \n) hmm...

oh hey, I found out how I know that Ctrl+R is the key that invokes reverse-i-search:
$ bind -q reverse-search-history
reverse-search-history can be invoked via "\C-r".

ok, so to translate what you said... the default is this:
$ bind "set isearch-terminators '\033\012'"
even though `bind -v | grep isearch-terminators` shows nothing before I run that command because it's not set.

So if I run this:
$ bind "set isearch-terminators '\012'"
then the issue is gone and reverse-i-search works, with the caveat that it breaks when you try to rpess left/right arrows by it typing in "[D" respectively "[C" , but it doesn't happen the first time right after paste, only if I just do Ctrl+R type some string, press arrow...
I see that left/right arrow keys yield ESC[D and ESC[C respectively. So it eats the ESC, it still terminates the i-search, then continues to type what's left: "[D" or "[C". Confused as to why. I thought ESC shouldn't terminate i-search anymore, given that I've set it to just newline(\012 aka \x0a). At this point I'm questioning my sanity, my (mis)understanding of things thus far.

I'm still not sure where the ESC that breaks it comes from, is it from the highlight?
like something similar to $ echo -e '\033[47mPASTED' to get white-ish background?

I'm confused whether or not this is fixable by bash, or should I have to use that \012 terminator workaround? Please advise :) Thx.

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: pasting in bracketed-paste mode breaks reverse-i-search gentoo_eshoes@tutanota.com - 2020-04-21 22:25 +0200

csiph-web