[PATCH] Fix scrollback search with bracketed paste

Marc Lehmann schmorp at schmorp.de
Fri Mar 13 12:18:32 CET 2020


On Sun, Mar 01, 2020 at 08:23:32PM +0100, Daniel Gröber <dxld at darkboxed.org> wrote:
>    TODO: bracketed paste mode pastes ^[[200~ etc. into incremental-search inputs
> 
> which has annoyed me for a while now, so I went ahead and fixed it, patch
> attached.

Hi!

I think the idea of saving/restoring the mode is not such a good solution,
as it overwrites any app-saved state and also doesn't properly restore
when there are intermediate changes.

I've made an alternative patch that brutally regexes-away the
bracketed-paste sequences from the search term. This should be safe as you
can't normally enter escape into the search anyway.

It doesn't feel super-stable, but at least it doesn't require stomping
over app state.

Could you try it out and see it works for you (I also installed it in CVS)?

diff -u -p -r1.44 searchable-scrollback
--- src/perl/searchable-scrollback  24 Oct 2017 20:12:08 -0000      1.44
+++ src/perl/searchable-scrollback  13 Mar 2020 11:13:46 -0000
@@ -244,6 +244,7 @@ sub tt_write {
    my ($self, $data) = @_;
 
    $self->{search} .= $self->locale_decode ($data);
+   $self->{search} =~ s/\e\[20[01]~//g;
 
    $self->{search} =~ s/^\(\?i\)//
       if $self->{search} =~ /^\(.*[[:upper:]]/;

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the rxvt-unicode mailing list