Community
    • Login

    put search result right in the middle of screen

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    15 Posts 7 Posters 2.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • PfiffikusP
      Pfiffikus
      last edited by

      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 …

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Pfiffikus
        last edited by

        @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)

        Alan KilbornA PfiffikusP 2 Replies Last reply Reply Quote 2
        • Alan KilbornA
          Alan Kilborn @PeterJones
          last edited by

          @PeterJones

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

          1 Reply Last reply Reply Quote 2
          • PfiffikusP
            Pfiffikus @PeterJones
            last edited by

            @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 …)?

            Alan KilbornA 1 Reply Last reply Reply Quote 1
            • Alan KilbornA
              Alan Kilborn @Pfiffikus
              last edited by Alan Kilborn

              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.

              1 Reply Last reply Reply Quote 1
              • guy038G
                guy038
                last edited by guy038

                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

                Alan KilbornA PfiffikusP 2 Replies Last reply Reply Quote 3
                • Alan KilbornA
                  Alan Kilborn @guy038
                  last edited by

                  @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

                  1 Reply Last reply Reply Quote 2
                  • PfiffikusP
                    Pfiffikus @guy038
                    last edited by

                    @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 ;(

                    Alan KilbornA 1 Reply Last reply Reply Quote 0
                    • Alan KilbornA
                      Alan Kilborn @Pfiffikus
                      last edited by

                      @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. :-)

                      astrosofistaA 1 Reply Last reply Reply Quote 1
                      • astrosofistaA
                        astrosofista @Alan Kilborn
                        last edited by

                        @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!

                        Auryn MeA 1 Reply Last reply Reply Quote 2
                        • Auryn MeA
                          Auryn Me @astrosofista
                          last edited by

                          Hi guys,
                          i answer to this old post because what you said here helped me but it is not really the solution to my problem.
                          My first problem was the same as the guy that opened this post and that the search result was on the right side of the window and actually what mattered to me, was exactly after what i seached and i had to painfully scroll right to reveal what i needed.
                          The formula above helped with this problem but i have another problem related to this.
                          I have JSON files where 1 line is thousands of character long.
                          I need to search for something (let’s say “Parameter[”) and then change what is next and this x times on the same line.
                          The search result window, show always line 6 (in my case) and all the text from the beginning of that line so that i see only the first maybe 2-3 occasions of “Parameter[” and then just a repetition of the beginning of the line for each further hit.
                          Sure, when i click it, it jumps on the right spot in the editor but it would be very useful if the search window could show only starting from the search hit onwards.
                          Is there a way to do that??

                          Alan KilbornA Mark OlsonM 2 Replies Last reply Reply Quote 0
                          • Alan KilbornA
                            Alan Kilborn @Auryn Me
                            last edited by Alan Kilborn

                            @Auryn-Me said in put search result right in the middle of screen:

                            files where 1 line is thousands of character long.

                            it would be very useful if the search window could show only starting from the search hit onwards.
                            Is there a way to do that??

                            Not really.

                            A search hit could be anywhere in long lines (lines that are too long to show their entire length in the window). So, for example, the first match’s hit text could be in column 1 of the first line of output, the second match’s hit text could be in column 2000. I think you can see the logistical problem; there’s no way to show both column 1 and 2000 at the same time.

                            If lines are really long, they are truncated in the Search results window and a ... is put at the end. I suppose something like this could be done at the start of each line, and individually for each line, thus keeping search hit text in roughly the same column of each output line. But this isn’t how Notepad++ currently works and would involve someone making a feature request for new behavior, and having the developers agree to implement it.

                            1 Reply Last reply Reply Quote 0
                            • Mark OlsonM
                              Mark Olson @Auryn Me
                              last edited by Mark Olson

                              @Auryn-Me said in put search result right in the middle of screen:

                              I have JSON files where 1 line is thousands of character long.
                              I need to search for something (let’s say “Parameter[”) and then change what is next and this x times on the same line

                              You might find the JsonTools plugin useful.

                              Example usage (using a randomly generated “tweet” using a Twitter’s API schema):

                              69d8f212-04dd-4c2c-9adc-b52dd649ec92-image.png

                              The tree view above the Find/replace in JSON dialog box shows a list of results, and when you click on a node in the tree (or navigate to that node using the arrow keys after selecting another node), the caret jumps to the location of the corresponding text in the document, as shown above.

                              Auryn MeA 1 Reply Last reply Reply Quote 2
                              • Auryn MeA
                                Auryn Me @Mark Olson
                                last edited by

                                Thanks to boths.
                                Sadly it seems i under estimated how complicated this JSON will become.
                                I am trying to translate a game from japanese to english but the text is interleaved with formatting “codes” and graphics/sound calls. It seemed that by searching “CodeName”:“文章の表示”,“parameters”:[ (that japanese text meaning “Display of text”) I would find the text just after it (see the bottom hit).
                                Sadly as you can see on the first hit, it is not the case because after my search there are more “calls” before the text and by parsing the JSON in this Hex editor, i saw that there are even text without the part i was searching. I probably need to slowly parse it by hand :(
                                And yes, not all japanese text has to be translated because example SExxxx/BGSxxxxx are sound effect and background sounds.
                                Thanks anyway.

                                "012b477c-5241-48cf-861e-e50a160fd49e-image.png

                                Auryn MeA 1 Reply Last reply Reply Quote 0
                                • Auryn MeA
                                  Auryn Me @Auryn Me
                                  last edited by

                                  I got progress :)
                                  I found a JSON Formatter / Validator that formatted that mess from above to this:
                                  0c957bdb-81df-457e-8f99-4689fedeafd2-image.png
                                  Look much more easy to work with, the game accepts it and i can use Notepad++ :)

                                  1 Reply Last reply Reply Quote 2
                                  • First post
                                    Last post
                                  The Community of users of the Notepad++ text editor.
                                  Powered by NodeBB | Contributors