Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Chet Ramey Newsgroups: gnu.bash.bug Subject: Re: pasting in bracketed-paste mode breaks reverse-i-search Date: Tue, 21 Apr 2020 17:50:36 -0400 Organization: ITS, Case Western Reserve University Lines: 84 Approved: bug-bash@gnu.org Message-ID: References: <62817207-4c7b-491e-2c5a-a57128e04b88@case.edu> Reply-To: chet.ramey@case.edu NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: usenet.stanford.edu 1587505849 6717 209.51.188.17 (21 Apr 2020 21:50:49 GMT) X-Complaints-To: action@cs.stanford.edu Cc: chet.ramey@case.edu, bug-bash@gnu.org To: gentoo_eshoes@tutanota.com Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=smtp-primary; t=1587505842; bh=/H0j3Fupnl6XuKmx0b4ebKr7TLLYMx3SLE3kwgY8/C0=; h=Reply-To:Cc:Subject:To:References:From:Message-ID:Date: MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=6qwbD5yvLMdKAcNlT1SnZ7Jbjf8YXmDTkjegKFgX3oie6+eJGZNU62D7Tek3lOoHvT fwKTsJHI7SxhTA0ouLnDM6N2mBpgdIA+qdZZeXERua1T+OWCTW2zChNBuG0odwyuBwT t07z4I0oBCgmUEdsMMF4j5c1Y2j0dMn9+YA1YLRSRL4IF4awI4gvw/YHybseZcK2Sd7 FH6Hn0Ot6qjtzSBJRSQS5qB7iBbec+8Jt/5WktSJ707MIwNjs/wqfY+3quRjgFvQidX 5GHX6+qk8OTNeVP8dejBT1U1ePSzRoruUP4zUehIUjiQKpVRhJQBrSdfSI5kVMrID8s 8TBOn4EQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=smtp-primary; t=1587505840; bh=hlObkvuR7tQXUnX8wg9RYouYxBWeZfkbeT+A5s1KC6g=; h=Reply-To:Cc:Subject:To:References:From:Message-ID:Date: MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=t2FY+BvoSEHbpQzU87OaEqWB1Pkiz3RUEYZ/2uCMkjVJV/r0nfxvulSmnR+3Ypl/Fn kv/JDGvHdIoQwFnSFYl8OYEbMEMoX/wfaXD+PxDThRPh9TwxfNVUZNPaGtvb3XO4WPZ Du4qlLxS60J1J196I2KbmUro6nscN2+KEON6kTB3Edx41h85JNnAPKli8wX5XhRc+5/ ilY61Z73rNMar3ok/jyo6F01rYvHTWY1DucdVY8c72iJ/Q8rjqS2JpmEDblweWgQxd4 OfU7ydCJuc1giowASwa8FhagYUNf1SWk8aqcNQhxWW44RZ2yoWme9yewK4TrJhevUmR bcJcQ8iQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=g-case; h=reply-to:cc:subject:to:references:from:autocrypt:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=hlObkvuR7tQXUnX8wg9RYouYxBWeZfkbeT+A5s1KC6g=; b=ZPBYztsDIsI1ghX4/FaOSX3Hwz5sxbBzUBXQKIUcqm9cJej2zDBoDl5zjQO1xe3fvI 5Al71MjUD8f87t8uv7GBqs3+m09iwG80Nj2hwyQRxACaCyH59AZeLmOjM4CUXoOXUEnm NxyjLbczLAv04EH2DntjuZXxUGjwfjigYFs/WVtIu/TNdS9Cvc9ak0En4Hu1RgLwAIGe +Fl5TsB8EUa0Q/ELyzyxqxqmkPhAKrNeBjyjNgx+S5Qdhr9t5uvm+/um602jS3XT6l/7 YdFm0vbN15CX9u3HPgQnuvMJw67n6utJF0NpXCs4/8xcTcT5xUz1e9/GmdJolYwAE1Zh hvEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:cc:subject:to:references:from:autocrypt :organization:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=hlObkvuR7tQXUnX8wg9RYouYxBWeZfkbeT+A5s1KC6g=; b=Bs+/YZrPVEf1KahWmQPt5F03A4baOlkUXrKwAojFyelG6iZMdXGeMSiYCiA22zb3vL RlS5nQ2zhUV4mG29bTdUKxhDl3ciAzDTg0U/1XU+HYzaTgN2JiGIpyDHVVTsCweSKg4F Esu3O/A7uswmsVuUMTaYlsKbivoWvavph+OTIa5ppkDsZ3SYBXTrQ54iScw4HxAxdWDz 08rE6NfPzu8k1PH+w8lCGi2PakhJDoroDVLQU3f8UlNRh5FhpW5Ez7PwAS34h3XChVtH 23DW3W1K4LxY0qHtvnuo0bJc86P89/digwVjJbqEsBKzkb76DM7vjG8GRBkusmjOq3Ia 422Q== X-Gm-Message-State: AGi0PubSsjH9ecjq8fsVA1H1E801r8B9k/IWyYC3ZEw+3T3xgXZX64+I fl4H2Y+k2jqhmRkMgHUAChKAsoDd/qg4R2JJagXGchq/M7q4CIRwCdMW0Yyz3avq0nEaf6JZsMI wKiL/zW+5BpQ= X-Received: by 2002:aed:3ff4:: with SMTP id w49mr12766278qth.61.1587505838963; Tue, 21 Apr 2020 14:50:38 -0700 (PDT) X-Google-Smtp-Source: APiQypIM0a3/tn0Hcxu123yY1EWODnkdDUlZQRMPLVSItouI4X5hDqqkesEZWp1EV5eKd0Tg+i7DXg== X-Received: by 2002:aed:3ff4:: with SMTP id w49mr12766255qth.61.1587505838557; Tue, 21 Apr 2020 14:50:38 -0700 (PDT) Autocrypt: addr=chet.ramey@case.edu; prefer-encrypt=mutual; keydata= mQGiBEEOsGwRBACFa0A1oa71HSZLWxAx0svXzhOZNQZOzqHmSuGOG92jIpQpr8DpvgRh40Yp AwdcXb8QG1J5yGAKeevNE1zCFaA725vGSdHUyypHouV0xoWwukYO6qlyyX+2BZU+okBUqoWQ koWxiYaCSfzB2Ln7pmdys1fJhcgBKf3VjWCjd2XJTwCgoFJOwyBFJdugjfwjSoRSwDOIMf0D /iQK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-To: Content-Language: en-US X-Mirapoint-IP-Reputation: reputation=Good-1, source=Queried, refid=tid=0001.0A020301.5E9F6405.0014, actions=tag X-Mirapoint-IP-Reputation: reputation=good-1, source=Fixed, refid=n/a, actions=tag X-Junkmail-Status: score=8/80, host=mpv2-2015.case.edu X-Junkmail-PrAS-Raw: score=8/80, refid=2.7.2:2020.4.21.210017:17:8.510, ip=, rules=__YOUTUBE_RCVD, DKIM_SIGNATURE, __X_GOOGLE_DKIM_SIGNATURE, __HAS_REPLYTO, __HAS_CC_HDR, __MULTIPLE_RCPTS_CC_X2, __SUBJ_REPLY, __BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT, __SUBJ_ALPHA_END, __TO_MALFORMED_2, __TO_NO_NAME, __HAS_REFERENCES, __REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA, __USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN, __DKIM_ALIGNS_1, __DKIM_ALIGNS_2, __ANY_URI, __URI_MAILTO, __URI_WITH_PATH, __URI_ENDS_IN_SLASH, __URI_NO_WWW, __HIGHBITS, __CP_URI_IN_BODY, __FRAUD_MONEY_CURRENCY_DOLLAR, __SUBJ_ALPHA_NEGATE, SUPERLONG_LINE, __URI_IN_BODY, __URI_NOT_IMG, __MAIL_CHAIN, __FORWARDED_MSG, __BODY_NO_MAILTO, __NO_HTML_TAG_RAW, BODY_SIZE_4000_4999, [TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138 Received-SPF: pass client-ip=129.22.103.227; envelope-from=chet.ramey@case.edu; helo=mpv1-2015.case.edu X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/21 17:50:40 X-ACL-Warn: Detected OS = Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 129.22.103.227 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <62817207-4c7b-491e-2c5a-a57128e04b88@case.edu> Xref: csiph.com gnu.bash.bug:16221 On 4/21/20 4:25 PM, gentoo_eshoes@tutanota.com wrote: >> 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 Not exactly. Bracketed paste mode is called that because it `brackets' the pasted text with special escape sequences. That's how you can recognize it as a paste -- otherwise it just shows up in the input stream as if the text had been typed. The escape sequences, like just about everything else with terminals, start with ESC. $ grep BRACK_P rlprivate.h #define BRACK_PASTE_PREF "\033[200~" #define BRACK_PASTE_SUFF "\033[201~" #define BRACK_PASTE_LAST '~' #define BRACK_PASTE_SLEN 6 #define BRACK_PASTE_INIT "\033[?2004h" #define BRACK_PASTE_FINI "\033[?2004l\r" The last two are what you send when you want to start and stop using bracketed paste mode, respectively. The bracketed paste prefix and suffix serve only to delimit the text. They allow readline to recognize that a paste took place and mark the boundaries of the pasted text so the redisplay can highlight them later. > >   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. You haven't set it, so it gets the default. > > 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 It doesn't really. What happens is that it reads enough characters to resolve to a bound key sequence, finds the function (backward-char), and assumes that it should break the search and execute that function (this is standard incremental search behavior). The problem is that it doesn't save enough of the key sequence to do that -- it just pushes the current and previous characters back onto the input. I should do something about that sometime, but it really hasn't been a problem until now. > I'm still not sure where the ESC that breaks it comes from, is it from the highlight? See above. > like something similar to $ echo -e '\033[47mPASTED' to get white-ish background? Similar. > I'm confused whether or not this is fixable by bash, or should I have to use that \012 terminator workaround? Please advise :) Thx. I'll have to add something to change this. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/