View Single Post
Old 01-07-2012, 04:13 PM   #49
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
I've changed it to start a new search from the cursor position instead of using a cache with every match location. There won't be any difference in behavior in normal modes.

In Regex mode the difference is the start (or end) of the text is computed based upon where the cursor is located instead of the previous match if we searched for every non-overlapping match from the beginning of the document. This means the count of all occurrences won't necessary match the number of times find next will match. This is because one match could have multiple matches inside of it. Meme's example illustrates this.

Due to the way regex's work I can't figure out how to do them in reverse for find backward. So find backward is the original method of start at the beginning of the document and move forward finding all non-overlapping matches until the cursor position is reached. The last match is then used. In Meme's example, if you put the cursor at the end of the document the larger matching block is selected instead of the smaller one that is closer to the end. This is because the smaller match is inside of the larger one which is matched first.
user_none is offline