Preferences option to show only one line in search results



  • I have seen the question asked 4+ times after scouring almost a hundred threads.

    It isn’t useful to me, and I imagine that other either, that searching ABC of:
    Here is ABC then another ABC lastly followed by an ABC

    Why not just one line of 3-way highlighted output?

    If not, can we add a Preferences checkbox? Should be easy to implement.

    Searching for variable hits in source code often have the same class names multiple times on the same line. I can easily get 3 hits for every real line, total of 100+. Too much to eyeball to find the half dozen offending lines that matter. Also, these search results happen in blobs, and I only want one of those.

    Which use case needs all the search hits explicitly listed as a separate result?

    I donate every year :)



  • @Hans-Schulze said in Preferences option to show only one line in search results:

    Which use case needs all the search hits explicitly listed as a separate result?

    Often people are short-sighted when they complain.

    Here is the answer: When a line in the Find-result window is double-clicked, the editor window is adjusted to find the match. If multiple matches per line occur, the logic needs to know which match should be highlighted and the caret placed at.

    To produce just one line in the Find-result window for a line in the editor window that has multiple matches, use this type of regular expression find-all: ABC(?-s).*? This will find the first matching ABC on a line and will include the rest of the line in that match. Thus, even if the remainder of the line contains more ABC, there is only one match for the line. Disclaimer: I’m not near Notepad++ right now where I can test the above, so I can only say I think it will work. It may need some tweaking.

    Should be easy to implement.

    This is a great statement, most often cited by people that have no clue about software development. Perhaps the OP will respond and say they are a long-time software developer; to which I would then say “Shame on you for making such a statement, then”. :)


Log in to reply