Show search result on top or bottom of current view



  • Hi,

    I would like to have an option in “Find” window (or general setting) where I can specify if a search result is shown in the middle (this is currently standard as it looks like) or on top or on bottom of the current view.

    Reason:
    Sometimes the content below a search result is important,
    sometime the content above a search is important
    and sometimes the middle is perfect.

    Very very nice would be if in “Find” window I could specify the numbers of lines above and below a test result are shown (and all others disappear).
    ;-)

    Thank you in advance!
    And thank for this GREAT software!!!

    Best regards
    Thomas



  • @Thomas-Weiß

    So…that sounds like a feature request, and that’s fine, except no one that matters to the process of handling that feature request will see it here. The proper place for a feature request is found by following the instructions HERE.

    That being said, it is possible your feature request will not be acted upon. :-(

    But…something could be scripted such that when you hit a keycombo, the line of the caret is “jumped” to the top/bottom of the current viewport – would that be valuable?

    I’m thinking something like what was presented HERE.



  • @Alan-Kilborn

    Thank you very much for that hint.
    I have placed the feature request here.
    https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9629

    Feel free to support it!
    ;-)

    Best regards
    Thomas



  • So I ended up scripting a little mock up demo of this, which I won’t post unless there’s interest, but really there’s only a couple of new things that need to happen after a search match to make this work:

    • find the number of lines shown on screen

    • set the first visible line to a correct value (based upon the starting line of a find match, and the number of lines shown on screen, and of course the desired effect specified by the OP)

    • hmm, maybe it gets a tad more complicated if text between the match and the top of screen has folded/hidden lines…

    However, looking at how N++ moves the display/selection when a match is found, there seems to be a lot going on with the logic, so I’m not sure how well any changes would fit in.