put search result right in the middle of screen
-
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 hitCtrl-H
thenCtrl-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) -
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 theFind result
panel ! This should help you to easily visualize the different hits !Simply, right click inside the
Find result
panel and choose theWord 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 fortest.{20}
Such a match on a long line would scroll a hit of
test
plus the following 20 characters into view horizontally. Adjust the20
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!
-
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?? -
@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. -
@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 lineYou might find the JsonTools plugin useful.
Example usage (using a randomly generated “tweet” using a Twitter’s API schema):
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. -
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."
-
I got progress :)
I found a JSON Formatter / Validator that formatted that mess from above to this:
Look much more easy to work with, the game accepts it and i can use Notepad++ :)