put search result right in the middle of screen



  • I would really appreciate, when I could center the location of the search result right in the middle of screen: Imagine a long text wider than the screen. The vertical centering seems to be okay (although it’s also not the vertical center), but the horizontal one puts the marked search result often just to the (right) margin.
    For a prompted Search&Replace I need the context of the search result and currently have to use the horizontal scroll bar …



  • @Pfiffikus ,

    The Find result window can be either docked or floating. When docked, it stays on whichever edge you leave it docked to. When floating, it remembers the last place you put it. So if it’s not where you like it, put it where you like: it will remember the location, even if you close the results window and re-open it, or even after exiting Notepad++ and coming back. (When it’s docked at the bottom, it has just about as much width real estate as the main editor window, so there isn’t much mismatch in available vs scrolled width when it’s docked at the bottom. That’s where I prefer it, in the rare instances I use the Find All In… options)

    The Find (or Replace) window also remembers where you last put it. If you want to re-center that one, you can hit Ctrl-F twice in a row (once to open the Find dialog, once to re-center it), or hit Ctrl-H then Ctrl-F (the first opens the dialog in Replace mode; the second moves the dialog to the center – unfortunately, Ctrl-H twice in a row will clear the existing search from the Replace dialog, but doesn’t center the dialog)



  • @PeterJones

    I think OP means the location of the hit’s selected text when Find Next is used.



  • @PeterJones, many thanks for your explanation how to move the dialog’s window (I’ve never done it this way, but now I will …).
    My concern is the movement of the text: How to set the marked search result into the center (assuming the dialog is not there …)?



  • I think OP means the location of the hit’s selected text when Find Next is used.

    …although an equally valid question is how to get the highlighted hit text in the Find result window (to be auto-horizontal-scrolled) so when you have really long lines, and the hit is not near the beginning of the lines. Answer: I don’t think you can.



  • Hello, @Pfiffikus, @alan-kilborn, @peterjones and All,

    @Pfiffikus, since the last v7.9.1 N++ version, you can split long lines of the Find result panel ! This should help you to easily visualize the different hits !

    Simply, right click inside the Find result panel and choose the Word wrap long lines option ;-))

    Best Regards,

    guy038



  • @guy038 said in put search result right in the middle of screen:

    since the last v7.9.1 N++ version, you can split long lines of the Find result panel

    Actually a feature of 7.9.0



  • @guy038, many thanks for that hint … but I like to use such feature in a dialog-based search&replace
    How to use the Find-Result-Panel in this workflow?

    BTW: … right click inside the Find-Result-Panel … is really a very new feature: … Word wrap long lines isn’t translated into German ;(



  • @Pfiffikus said in put search result right in the middle of screen:

    but I like to use such feature in a dialog-based search&replace …
    How to use the Find-Result-Panel in this workflow?

    The horizontal scrollbar only scrolls enough to show you your entire matching text.
    Automatic horizontal scroll by N++ is a bit different than vertical scroll for this purpose.

    Here’s a workaround you won’t like :-)

    Do your search in Regular expression search mode and add .{20} to the end of your find text.

    For example, if you want to search for test then instead search for test.{20}

    Such a match on a long line would scroll a hit of test plus the following 20 characters into view horizontally. Adjust the 20 to a number that meets your need.

    Note: There are problems with this approach. Truly one should do it this way: \Qtest\E(?-s).{20} but…I realize that no one is going to type all that to achieve this workaround. :-)



  • @Alan-Kilborn said in put search result right in the middle of screen:

    Truly one should do it this way: \Qtest\E(?-s).{20} but…I realize that no one is going to type all that to achieve this workaround. :-)

    Sure, for that I would try something like this AutoHotkey —the * removes the hotkey expression— in the search field:

    :*:qre::
    SendInput, {text}\Q\E(?-s).{20}
    SendInput, {Left 12}    ; sends the caret back between \Q and \E
    return
    

    Have fun!


Log in to reply