N++ 7.7 new feature: Count in Selection

  • Has anyone experimented with “Count in Selection”?:


    I’ve experimented…and it works…but I can’t really think of any (non-contrived) situation in which I’d use it. I can’t recall ever having wanted to do this kind of “search” in the past, ever.

    Well…maybe as a binary found-it-one-or-more-times, or didn’t-find-it thing…maybe…but never as a oh, there’s 7 in that selection, without then wanting to know where those 7 matches actually are located in that selection, which currently can’t be done.

    What do others think? Is this a valuable feature addition and I am just not seeing why?

  • @Alan-Kilborn

    It can be useful when you search in a source code with many sub routines, where the same variable name might be used in different sub routines, but you only want to know if a variable is used in a certain sub routine (maybe you want to check whether you renamed all instances of that variable, so 0 would be the expected result).

    You can select the code of this routine (this might be possible even with keyboard shortcuts when using Begin/End select and the YEtc plugin which is able to jump between fold points) and use the Count in selection feature of the Find dialog.

  • @Alan-Kilborn

    closing and rejecting feature request #722 lead to a follow up post by @Scott-Sumner, and this in turn has lead to it’s implementation.

  • @Meta-Chuh said:

    closing and rejecting feature request #722 led to…

    I see.

    In that issue comment thread it is said “it’s hard for making a consistent UI if we want ‘in selection’ for every find command”. To that I’d say, why not just remove the little border that boxes in the In Selection checkbox and the Count button?


    Seriously, though, I’d guess that the code to do, for example, Find All in Current Document with In Selection as a qualifier is much harder than the Count version, otherwise why not include it? I’d use that variant quite often.

Log in to reply