A question on searching

SyntaxEditor for WPF Forum

Posted 13 years ago by Kasper
Version: 11.1.0545
Avatar
Hi guys,

I would like to support searching in my application much like it is in e.g. Firefox, where I start typing something in the search field and then the first possible match is highlighted. I have tried implementing this using the standard Searcher property on the ActiveView, and except for one detail, it's working well. The only problem is that once a partial match has been made and the user types in the next character, a call to FindNext() will ignore the current match, even though the added character is also a part of the first match. So, for instance, if I have the word "test" in my SyntaxEditor in four different locations, each time I type in a character of the word, it jumps through each of the "test" occurrences. I imagine that this happens because the SyntaxEditor makes a selection after FindNext() has been called, and then performs the next search at the end of this selection - what I want is simply to expand the selection to include the newly typed character, if the word is still a match, and if not, jump to the next occurrence. I might be able to pull this off using some sort of hack, but I was wondering if this can't be done pretty easily and if so, how. Hope you can help :)

[Modified at 08/29/2011 08:48 AM]

Comments (1)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Kasper,

If you use the editor view search model, then yes, it will search after the selection for the next match. That matches similar to VS find dialogs.

However there is a lower-level document-related search mechanism that the editor view model wraps and uses. You would probably want to call that instead since there you can specify the start offset, etc. It's described in the documentation topic "Text/Parsing Framework - Advanced Text Features / Low-Level Search Operations."


Actipro Software Support

The latest build of this product (v24.1.2) was released 2 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.