Author Topic: Highlight word, words, phrase, column and lines  (Read 4856 times)

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
Highlight word, words, phrase, column and lines
« on: May 01, 2009, 05:33:28 PM »
Highlight word, words, phrase, column and lines

Just for the todo list.

HippoEDIT is already able to set font and back ground color for specific words or phrases.

Please see picture to see what i mean.

I have used this code to make this happen :



    <STYLES>
     
      <Style id="HiLiWord" name="HiLiWord" text="1" bold="0" italic="0" underline="0" clr="#000000" bkclr="HiLiWord">
        <Blocks>
          <Block open="Fixed:" close=""/>
        </Blocks>
      </Style>

      <Style id="HiLiWord2" name="HiLiWord2" text="1" bold="0" italic="0" underline="0" clr="#000000" bkclr="red">
        <Blocks>
          <Block open="Added:" close="\n"/>
        </Blocks>
      </Style>
     
      <Style id="HiLiWord3" name="HiLiWord3" text="1" bold="0" italic="0" underline="0" clr="#000000" bkclr="blue">
        <Blocks>
          <Block open="Lister" close=""/>
          <Block open="FTP" close=""/>
          <Block open="wincmd.ini [Configuration]" close=""/>
          <Block open="Total Commander" close=""/>
        </Blocks>
      </Style>
                 
    </STYLES>


You can use this in any *_spec.xml  syntax file you want.
Just add this to <STYLES>...</STYLES> section

HiLiWord, red and blue are colors i had defined in "Tools > Color Schemes... > Add..."


------------------------- Point 0)

The idea is that there is sometimes (after 1.5) an dialog to make this easy for the user, like:


Phrase start:     Phrase end:          Use RegEx       Case sensitive     Color                Active
1 [Added:        ]   [\n              ]       [  ]                [X]                 [red     |v]        [X]
2 [Fixed:         ]   [                 ]       [  ]                [X]                 [yellow |v]        [X]
3 [\d\d\.04\.    ]   [                 ]       [X]                [  ]                 [yellow |v]        [  ]
4 [Total Commander]   [           ]       [  ]                [  ]                 [blue    |v]        [X]

View.HighlightPhrase1
...
View.HighlightPhrase9

This could be an menu item and work for all syntaxes.
This way we could easy enable and disable the highlighting and add or remove phrases.
But before HE has to learn to use modified syntaxes without an restart of HE.  But HE is worth to wait for that :D

Picture 1 below
--------------------





------------------------- Point 1)
EDIT:

Related idea,  colorize lines alternately  by white and  [Color |v]
like an file manager colorize files alternately
to have an help for reading long lists.
Colorize every [  3]  line with [Color |v]

Picture 2 below
--------------------






------------------------- Point 2)
EDIT2:

Related idea,  colorize columns at position:
From col: [   10]  till col: [  14]  [color |v]  [ ]Active
From col: [   23]  till col: [  34]  [color |v]  [ ]Active


------------------------- Point 2b)

and/or for coma separated values:
Delimiter [ ; ]     [grey  |v]
Start at line [  4]
to colorize columns alternately  by white and grey, change color at every delimiter.

Picture 2 below too
---------------------------






------------------------- Point 3)
EDIT3:

BTW: perhaps it's an idea to highlight optional the current column (like the current line) too?
See Picture 3, an screenshot from VIM

_
« Last Edit: May 03, 2009, 06:50:11 PM by Stefan »
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • My Blog
Re: HowTo Highlight word, words, phrase and lines
« Reply #1 on: May 01, 2009, 07:48:06 PM »
I see this useful in log analysis scenarios, especially with the AutoReload option enabled.

Offline JJK

  • Registered User
  • Full Member
  • *
  • Posts: 152
  • Karma: +2/-0
Re: Highlight word, words, phrase, column and lines
« Reply #2 on: May 02, 2009, 12:34:39 PM »
Point 0 ) Impressive : HE allows us to do such thing !! Very good example. I'll use it ASAP, because it is very useful.
Sure, a dialog to facilitate creation of that colorisation would be handy. OK for after 1.50.

Point 1) Why not ? I would be rather simple to code, but I am not a very good programmer.
Point 2) A little complicated to my taste.
Point 3) Support for current column.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2190
  • Karma: +37/-3
    • HippoEDIT
Re: Highlight word, words, phrase, column and lines
« Reply #3 on: May 03, 2009, 06:29:06 PM »
Hi Stefan,

good ideas ;)

0) What you want probably is not a some enhancements for syntax highlighting, but some kind of persistent searches. Which you can maintain, assign to be autoexecuted for document, have defined colors etc. Specially because of Regex support. Syntax highlighting could not use it, because regex is MUCH slower (in worst case) then current algorithm. But of course and much more powerful... So, from my point of view, such persistent searches are more logical then mixing this into syntax definitions. If you want to have really special schema, than it is another deal.

I have one user which already uses scenario you have suggested. My advise to him was use overview="1" flag in style definition. This REALLY can help in log analysis because information then shown in overview bar and you do not need to search for it, you see it immediatelly.

The were also some ideas specially for logs (in plans): flashing styles, styles with sound etc ;)

1) Maybe  I would add this soon. Yes, easy. And I do not think that people really need such freedom as adding interval to apply.
2) Yes, also interesting. Some languages even requires that (cobol I think), but more difficult to implement for me. Maybe I would delay this for some specific request...
3) This is in todos, but not done because of the technical complexity for me (layering of styles).

Thanks a lot!
Good ideas.

Best regards,
Alex.

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
Re: Highlight word, words, phrase, column and lines
« Reply #4 on: May 03, 2009, 10:10:55 PM »
Thanks for support.

0) Phrase highlighting:  what ever implementation you see fit.  I have used syntax file only because it was all i had to play with.

'persistent searches'  sounds good and would do all i had in mind in my example above.
Well, maybe not the specific color for an pattern, which would be cool to colorize 'Error' in red and 'OK' with green.
But if we can get color  'Search Result 1 = red' , 'Search Result 2 = green'   (up to 'Search Result 9') 
it's only an matter of what pattern we would search first?  No it's to complicated and non-flexible.


Brainstorming:
Maybe do it like Total Commander: use stored search pattern (search favorites) in an separate dialog:
1) search for an pattern with "Find"-dialog
2) store it as favorite, f.ex. as "Line with error"
3) "View > Highligh Pattern..."  >> chose search favorite "Line with error" , assign an color and check "Enable Highlighting"


Search Pattern     BgColor       Enable
[               |v]       [       |v]         [  ]


EDIT: 14 May 2009
i have edit my post with an related idea to choose background AND font color at user will

Search Pattern     BgColor      FontColor        Enable
[               |v]       [       |v]       [   |v]              [  ]


-------------And, BTW...

Also we should think about how to implement this: stored search favorites may bloat the search favorite list.

And there should be an simple list to add 'words' to colorize them, without search before, just add to an list.
Highlight Text: BgColor, FontColor, Bold, underline, italic, match case, regex. Word list:[ ToDo]
(Boxer have such an list too, but simple and use one color for all items only)

-------------

OR Maybe such an complete separate feature is better then bother with search favorites?
- have an dialog (see pic below) to set color options and to add words and regex
- as addition have an option to select some text and assign highlight color '1st Group' or named like here 'Errors'



Edit Edit 19.05.2009:
yes, definitely there should be an easier implementation then "search favorites".
F.ex. I am just has opened "C:\WINDOWS\WindowsUpdate.log"
and i would like to highlight a few words - reported as tracks of an update error.
--- First searching them - mess up the search favorites - open highlight feature - select search
     favorite and assign color - would be too much, i think.
--- Better would be: open highlight feature - add (paste) words [or RegEx] and assign color - done
      (the proper RegEx i can test first with search)



-------------
Just a few thought to improve HippoEDIT and add new features with all care we can have.
Idea borrowed from ->here<-
« Last Edit: May 19, 2009, 01:55:23 PM by Stefan »

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2190
  • Karma: +37/-3
    • HippoEDIT
Re: Highlight word, words, phrase, column and lines
« Reply #5 on: May 03, 2009, 10:52:35 PM »
Yes, I was thinking about some additional submenu in View.
And when you create (store) such search/highlighter you can assign color to it, as it done for any style.

BTW: Alternating Mode would be available next beta (so I mean today everning)

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
Re: Highlight word, words, phrase, column and lines
« Reply #6 on: May 04, 2009, 03:51:30 PM »
Quote
------------------------- Point 1)
Related idea,  colorize lines alternately  by white and  [Color |v]

HippoEDIT 1.43 beta build 656 from 04.05.2009
New. Alternating mode display added. File and language specific. See View->Editor or new command View.Alternating Mode.



For already installed editors:
- update your data\colors\*.xml   
or copy  corresponding line      <Index name="Alternating" color="#C0C0C0D8" fore="true" back="true"/>   to your color_*. XML

- update def_spex.xml
or copy  corresponding line     <Style id="alternative" name="Alternative Color" dstyle="true" clr="Alternating" bkclr="Alternating" bold="2" italic="2" underline="2" overview="3"/>
   to your *_spec. XML

- with "Tools > Color Schemes > Alternating" you can chose the alternate color
- with "View-> Editor > Alternative Mode" you can enable this coloring (see picture)

-

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • My Blog
Re: Highlight word, words, phrase, column and lines
« Reply #7 on: May 04, 2009, 04:12:30 PM »
Thank you Stefan, a good post!
Besides, I have just tried that on a C# document in the new beta (1.43.656) without doing any amendments to the below mentioned XML files and it already gave me a very nice alternating line highlighting.

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
Re: Highlight word, words, phrase, column and lines
« Reply #8 on: May 14, 2009, 09:36:23 AM »
Thanks Arthur.

I have think some more about this issue and have >edit my post above with some more thought<

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
Re: Highlight word, words, phrase, column and lines
« Reply #9 on: October 06, 2009, 11:59:42 AM »
HippoEDIT 1.43 beta build 656 from 04.05.2009
New. Alternating mode display added. File and language specific. See View->Editor or new command View.Alternating Mode.



For already installed editors: do THIS

Hi Alex,  just FYI

i have seen that for fresh installed HippoEDIT (1.46.723)
this feature seams to do do nothing if enabled by checking "View > Editor > Alternative Mode"
because the alternative color is set by default to silver 84% alpha.
It seams that is to 'light' (at least i was fooled with my TFT), should be 60% so new user see an difference.


Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2190
  • Karma: +37/-3
    • HippoEDIT
Re: Highlight word, words, phrase, column and lines
« Reply #10 on: October 07, 2009, 02:54:03 PM »
On my TFT it is rather visible :) Probably depends from contrast settings.
But I can decrease transparency for default settings. No problem.