Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve highlight handling #74

Closed
1 of 2 tasks
haya14busa opened this issue Apr 19, 2015 · 9 comments
Closed
1 of 2 tasks

Improve highlight handling #74

haya14busa opened this issue Apr 19, 2015 · 9 comments

Comments

@haya14busa
Copy link
Owner

from #60 by @balta2ar

  • Do not turn off highlight until entering one character at least
  • Restore old highlight with <Esc>
@balta2ar
Copy link

Just to make sure we're on the same page, Restore old highlight with <Esc>, **if there was any** (if it was :nohls before, please don't call :set hls, just restore previous state).

@haya14busa
Copy link
Owner Author

Thanks for clarifying

@haya14busa
Copy link
Owner Author

@haya14busa
Copy link
Owner Author

I fixed it for restoring highlight in https://github.com/haya14busa/incsearch.vim/tree/dev branch and write a test case for this.

Could you please trying this branch?

@haya14busa haya14busa added the bug label May 1, 2015
@haya14busa
Copy link
Owner Author

Also, highlighting is cleared as soon as I type /. Is it possible to clear it only after I entered at least one symbol?

#60 (comment)

For the timing of clearing highlight, I'm already confortable with the current feature which turns off old highlight at starting incsearch.vim, so I doublt that clearing highlight only after entring at least one symbol is really useful.

Could you please giving me a situation or your some thought on this? Why is it useful to wait to clear highlight for entering characters?

@balta2ar
Copy link

balta2ar commented May 1, 2015

Thank you very much, @haya14busa! Highlighting restores fine!

As for the second part of my request, I don't think I can provide strong argument for that. It is something of my personal habits or perception, probably. Sometimes I press / to start search, but then I realize I don't want to search and I cancel it. The fact that highlighting is cleared before I typed an actual pattern kinda distracts me.

I can draw an analogy with Firefox. When you search for something and highlight it, it stays highlighted on the page. When you press Ctrl-f, cursor is moved to the search box, whole search pattern is selected, but old highlighting stays the same until you actually type something. Maybe I think of vim's / as a shortcut to activate the search box.

Let's speculate from the other side of the problem: what's the reason to clear highlighting as soon as / is entered? I understand that it's not technically cleared, it's the empty pattern, but still, how's this useful (besides of the obvious fact that it does not require any modifications to the plugin)?

@haya14busa
Copy link
Owner Author

Highlighting restores fine!

Thanks! I merged this fix into master now.

I can draw an analogy with Firefox.

I guess it's fair argument on this but it seems Chrome's search box feature is different from Firefox and do not highlight previous pattern.

what's the reason to clear highlighting as soon as / is entered?

Hmm... I also don't have strong reason for this. I just feel weird for not clearning highlight and it's simple and clean to implement this feature.
Unlike search box on some browsers, vim's / has history feature, so if you want to highlight previous one, you can just type <Up> or <C-p>.
I could say clearning old highlight helps us focus to new search.

@balta2ar
Copy link

balta2ar commented May 3, 2015

Okay, it looks like there aren't many strong arguments to any of the sides and considering it's easier to keep it as it is, let's leave it like that. Feel free to close the issue and thank you for your work!

@haya14busa
Copy link
Owner Author

Ok, I close this issue until someone will request the same feature or I change my mind.

Thanks @balta2ar 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants