vim-cool icon indicating copy to clipboard operation
vim-cool copied to clipboard

wrapping de-highlights all matches when the very first word of the buffer is a match

Open dys-bigwig opened this issue 6 years ago • 1 comments

When the first match is the very first word of the buffer, and you wrap from the very last match back to it via n, all matches are de-highlighted until you jump to the second match.

dys-bigwig avatar Feb 27 '19 12:02 dys-bigwig

This can be avoided with this change:

     endif
     let g:cool_is_searching = 1
     let [pos, rpos] = [winsaveview(), getpos('.')]
-    silent! exe "keepjumps go".(line2byte('.')+col('.')-(v:searchforward ? 2 : 0))
     try
         silent keepjumps norm! n
+        silent keepjumps norm! N
         if getpos('.') != rpos
             throw 0
         endif

This also fixes the issue that ?3 removes the highlight if the 3 is matched at the end of a line. It's because exe "keepjumps go".(line2byte('.')+col('.') does not move the cursor at the end of a line.

tobiwild avatar Jul 22 '23 15:07 tobiwild