bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: gentoo_eshoes
Subject: Re: pasting in bracketed-paste mode breaks reverse-i-search
Date: Tue, 21 Apr 2020 22:25:57 +0200 (CEST)



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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]