Tim Chase wrote:

> Coming up in this thread[1] on Reddit, I highlighted some text in
> *characterwise* visual mode ("v") and hit <esc> to end visual mode.
> With 'hls' set, issuing
> 
>   /\%'<\_.\{-}\%'>/
> 
> properly highlighted the range as expected.
> 
> So then I highlighted some text in *linewise* visual mode ("V") and
> hit <esc> and the highlight was removed.  Using "n" to search for the
> next match gave me an
> 
>   E486: Pattern not found: \%'<\_.\{-}\%'>
> 
> which seems mistaken.  Having done the linewise search, I can use
> 
>   `<
> 
> and
> 
>   `>
> 
> which both jump properly to the corresponding endpoints of the
> linewise visual selection, so in theory the
> 
>   \_.\{-}
> 
> should match everything in between (non-greedy).  I tried prepending
> both
> 
>   \%#=1
> 
> and alternatively
> 
>   \%#=2
> 
> to force the regex parsing engine, but both were equally unsuccessful
> with linewise mode.  So it doesn't seem to be some weird edge-case of
> either engine.
> 
> AFAICT, the regex *should* work for linewise visual selections, but
> for some reason doesn't.
> 
> Is this a bug?  Or just my misunderstanding of something?

I guess the problem is that the '> mark is at "MAXCOL".  That means "at
the end of the line".  But that position doesn't actually exist, so
searching for "\%'>" fails.

It probably works better when \%'> matches just beyond the last
character of the line, like /\n does.  You can create an issue for that.

-- 
CUSTOMER:     You're not fooling anyone y'know.  Look, isn't there something
              you can do?
DEAD PERSON:  I feel happy... I feel happy.
    [whop]
CUSTOMER:     Ah, thanks very much.
MORTICIAN:    Not at all.  See you on Thursday.
CUSTOMER:     Right.
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/202105222225.14MMPrKR918842%40masaka.moolenaar.net.

Reply via email to