#1 Highlight alone words in different color

1.0
open
nobody
2014-06-04
2014-05-28
alexey
No

Good job - thank you. Maybe it has sense to highlight word which has only one occurrence in different color. Plus is it possible to make ticks on line-numbers bar those will indicate where highlighted words are?

Discussion

  • Ioan
    Ioan
    2014-06-04

    ■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
    A different color to highlighting the word when there is only one occurence
    may be confusing. Consider following use-case:
    1. You open a file with 999 lines,
    The editor shows you lines 1..70.
    You may scroll down, to see other lines, but
    now you only see lines 1..70.

    1. You select word 'sentence' which occurs only once in lines 1..70.
      Word 'sentence' appears also in line 401.

    What should the output be?
    [A] The plugin uses a different color.
    [B] The plugin uses the color it uses when you have several occurences
    visible in the editor.

    Okay. This was the concern that a different color may be confusing.

    ■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□

    There is another concern with implementing a different color for the plugin.
    Here it goes. Currently, each time a word is selected, the plugin searches
    the selection only in the visible text, using the Knuth–Morris–Pratt algorithm.
    Doing this, the operation of highlighting all visible occurences is hopefully
    fast enough so that the editor does not block while doing the highlighting.
    If we try to use a different color to highlight the occurrence when there is
    only one occurrence, then we may want to search all file. Searching all
    file may slow down the editor. Okay. This was the concern about
    needing to search all file.

    ■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□

    How is best to interpret that word has only one sentence?
    Say file is:


    01. sky
    02. sun
    03. sky

    Say you select word 'sky', in line 3.
    Should we define that 'sky' has only one occurrence?
    (The occurence in line 1.)

    Convention:
    [1] ◐ - start verbatim
    [2] ◑ - end verbatim
    [3] In the verbatim section, each line is numbered.

     
  • Ioan
    Ioan
    2014-06-04

    Hello.

    I think that it is possible to make ticks on the line-numbers bar
    so that the ticks indicate where highlighted words are.

    I consider adding this feature in a 'fork' to the plugin, hosted
    as a demo in the https://sourceforge.net/projects/herebesoftware/
    project. Why there? I would like to keep the
    plugin as simple as possible. However, if this feature is
    useful (I guess it may be if you are editing files with long long
    lines), then why not write the feature.

    For long long lines, maybe line wrapping helps.

    Okay. The plan is to add feature in a demo pluging hosted
    in https://sourceforge.net/projects/herebesoftware/.
    I do not know when I would have this done, but when I do, my
    plan is to add a post here, to give a link to the demo plugin.