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

Keyword highlighting improvement and new functionality #38

Closed
severach opened this issue Jun 26, 2018 · 7 comments
Closed

Keyword highlighting improvement and new functionality #38

severach opened this issue Jun 26, 2018 · 7 comments

Comments

@severach
Copy link

severach commented Jun 26, 2018

Keyword highlighting: mark a word and all words like it are highlighted.

Notepad++ has two different methods of keyword highlighting, marking a word with mouse or keyboard, and Style Token from the right click menu.

tape
tapestry
tapered
tape recorder

Mark tape on the first line with the mouse and we should only see highlights on lines 1,4 because mouse marking must be word based. This is necessary because many languages have single letter variables and we need to see where they all are without the false positives from any word that contains the letter. The Notepadqq crew disallowed highlights from single letter marking because is it so utterly useless to see every occurrence of a single letter all over the screen.

Mark tape on the second line with Style Token and we should see highlights on all 4 lines because Style Token is text based, not word based. This allows word prefixes to be highlighted without having to be words.

Another distinction is that mouse marking is case insensitive. Style token is case sensitive.

Style Token is additive. A token can be styled with all 5 colors and the color is some sort of sum of the selected colors.

Requests: Change mouse marking to be word based. Add non word based Style Token.

@martinrotter
Copy link
Owner

Hello, brother.

I see, I have actually never really used context-aware keyword highlighting. Maybe I could add some key to modify the behavior of current feature implementation.

For example pressing ALT and selecting some text could triggier CONTEXT-AWARE highlighting, while current usage (without ALT being pressed, just selections) would be kept.

What you think?

@severach
Copy link
Author

Cinnamon hijacks Alt-Mouse for move window. Alt-Mouse Alt-Shift-Arrow is usually used for column marking. Having to use a key would make it hard to discover and would make the functionality different than Notepad++. A config option would be better. Non whole word styling will be provided by "Style Token."

I like the live styling while dragging across text. One option is to live style non word based text while drag/shift and when the drag/shift is released the non whole words are unstyled and only the whole words remain styled. Marking part of a word only to have it unstyled when the mouse is released may cause bug reports.

Another option is to do both based on what has been marked. If the marked text is not a whole word then style non whole word text. If the marked text is a whole word then only style whole words. To let the user know that what is marked changes the style method you should distinguish the two styling methods in some way, maybe with a different color.

@martinrotter
Copy link
Owner

What if I add checkable switch into editor context menu and into "View" menu? Something like "Use context-aware occurrences highlighting". This switch could be assigned to keyboard shortcut (for example CTRL+L) and its changes would apply immediately, so you can use it like this:

  1. You highlight some text with your mouse (for example ca) and (with THE switch being disabled) now all occurrences are highlighted (including cat or california).
  2. You hit CTRL+L and highlighting is switched to context-aware mode, now highlighted words are auto-updated and only ca is two-letter word is thus highligted.

Does this makes sense? Would it be good enough solution for you?

@severach
Copy link
Author

That sounds good.

@martinrotter
Copy link
Owner

martinrotter added a commit that referenced this issue Jul 14, 2018
@martinrotter
Copy link
Owner

Can you test the feature in latest development release for commit 081ae54?

@martinrotter
Copy link
Owner

@severach ping

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