npp search goes in unending loop, doesn't end where we started

  • when we search in npp, in search/ replace box or by f3-shift-f3, the search goes in unending loop,
    meaning, it keeps on presenting next occurrences of the word.
    it doesn’t end where we started.

    I mean it should remember where we had started, and once it has travelled to the end, and wrapped to the start of file and has travelled from the start of file to the position where we had originally started, it should stop there.

    That is what MS Word does, it remembers where we started, and seaches through the entire file only one time.


  • Occasionally I use NPP to manipulate bits of text and more often than not I use regular expressions during that process. While it is no criticism of the product (how can it be?), Notepad++ allows me to do stupid things that don’t behave as I intended. Case in point, I had a long list of values which I wanted to enclose in quote marks. I entered an accidentally aggressive expression and it caused an infinite loop.

    The reason for the loop is immaterial and is not the point of my question - I’ve made this mistake more than once - i know it doesn’t work, but I forget and months later will do the same thing again.

    The problem is that when NotePad++ goes into this infinite loop, trying to complete the imposisble, I am effectively locked out of all of my unsaved documents and forced to kill the NPP process.

  • @Training-Surat Thank God for Periodic Backup, right? Regular Expressions are an art as much as a science, but having said that, I’m aware of ways that Notepad++ does it less than ideally. But I agree that what it does, for the price, is absolutely awesome!

    @V-S-Rawat Half-jokingly, I say, “It’s not a bug, it’s a feature!” There have been discussions here where a user says, “I wish Notepad++ did [something] like [some program].” Then it gets implemented, and lots of other users complain because it doesn’t work like it used to. :)

    I understand what you’re saying, and sometimes it frustrates me too that I need to remember what line I started on. However, there are other times where I want to search for or replace a repeated part, and after I’ve been through the file once, there are still more instances that are repeated more than once, so that feature can come in handy. Here are some tips (used together or individually) to overcome this difference in functionality:

    • Use the count feature to count the number of occurrences before actually finding the text.
    • Set a bookmark (Ctrl-F2) before searching, then return to the bookmark after search (F2).
    • Go to the top of the file, use the Search/Replace box, and un-check the Wrap around checkbox

    There are probably more ways to manage this, but those are the ones I use when I absolutely have to get back to where I started when I’m finished.

Log in to reply