Clone Find All / Clone Find Flat could benefit from auto highlighting of search term

34 görüntüleme
İlk okunmamış mesaja atla

john lunzer

okunmadı,
11 Eyl 2017 22:01:5911.09.2017
alıcı leo-editor
I was comparing the Quick-Search plugin to Clone Find All / Clone Find Flat today and I realized one of the reasons I prefer Quick-Search is because it highlights my search term in the body text. I find this critical to quickly "flipping through" search results.

It would be awesome if each "Found" collector node could keep each individual search term highlighted for all their respective children. I think the syntax of the found collector node's is unique enough that auto highlighting could actually be done completely separately to the cfa/cff functionality. It could simply be in the form of an auto-highlight plugin that highlighted all the search terms given a specific regex in the node headline.

I'd like to get some thoughts on this, hopefully I'm not missing some obvious functionality already built into Leo.

john lunzer

okunmadı,
12 Eyl 2017 08:22:2012.09.2017
alıcı leo-editor
I've been pouring through the syntax highlighting code and I think I've actually come up with a pretty elegant solution: custom highlighting rules

The QSyntaxHighlighter is likely the best option for this. Basically rather than matching a regex syntax in a headline you would use the newly proposed directive @highlight. So for the simplest example, as it relates to clone-find-all and clone-find-flat, given the search term LeoHighlighter the Found collection node would include the directive @highlight LeoHightligher. The syntax highlighter would then either highlight or underline for every instance of the string "LeoHighlighter".

It feels very Leonine (directive based) and also self-explanatory/literate as the verb highlight is very explicit.

I'd like to get some feedback, I would like to start to try to develop this idea, but sort of want to get it blessed before I really start studying the highlight code.

Edward K. Ream

okunmadı,
21 Eyl 2017 11:34:5021.09.2017
alıcı leo-editor
On Mon, Sep 11, 2017 at 9:01 PM, john lunzer <lun...@gmail.com> wrote:

It would be awesome if each "Found" collector node could keep each individual search term highlighted for all their respective children.

​An interesting idea.
I think the syntax of the found collector node's is unique enough that auto highlighting could actually be done completely separately to the cfa/cff functionality. It could simply be in the form of an auto-highlight plugin that highlighted all the search terms given a specific regex in the node headline.

​This plugin sounds reasonable to me.

Edward

Edward K. Ream

okunmadı,
21 Eyl 2017 11:38:2521.09.2017
alıcı leo-editor
On Tue, Sep 12, 2017 at 7:22 AM, john lunzer <lun...@gmail.com> wrote:
I've been pouring through the syntax highlighting code and I think I've actually come up with a pretty elegant solution: custom highlighting rules

The QSyntaxHighlighter is likely the best option for this. Basically rather than matching a regex syntax in a headline you would use the newly proposed directive @highlight. So for the simplest example, as it relates to clone-find-all and clone-find-flat, given the search term
​​
LeoHighlighter the Found collection node would include the directive @highlight
​​LeoHighlighter. The syntax highlighter would then either highlight or underline for every instance of the string "LeoHighlighter".

​Yes, I think this could work.  Implementing it could be tricky, because entering any node would potentially push or pop a stack of custom rules.  Furthermore, these rules would themselves be non-trivial to do. For example, when @language python is in effect the custom rules would affect virtually all the data structures in leo\modes\python.py.

Edward

john lunzer

okunmadı,
24 Eyl 2017 15:46:1224.09.2017
alıcı leo-editor
I had gotten close to getting past the trickiness before I got slammed at work leaving no time after work for hobby dev. 

There is a lot I don't understand about the Qt/PyQt highlighter, running Leo in the debugger around the highlighting code was rough. Do you remember if there were any resources you used when initially writing the highlighter?

I'd still like to get this done if work lets up.

Edward K. Ream

okunmadı,
24 Eyl 2017 16:05:5224.09.2017
alıcı leo-editor
On Sun, Sep 24, 2017 at 2:46 PM, john lunzer <lun...@gmail.com> wrote:
I had gotten close to getting past the trickiness before I got slammed at work leaving no time after work for hobby dev. 

There is a lot I don't understand about the Qt/PyQt highlighter, running Leo in the debugger around the highlighting code was rough. Do you remember if there were any resources you used when initially writing the highlighter?

​There are several very effective traces in the leoColorizer.py.

Edward
Tümünü yanıtla
Yazarı yanıtla
Yönlendir
0 yeni ileti