ITextSnapshotReader.GoToNextWordStart

SyntaxEditor for WPF Forum

Posted 6 years ago by Daisuke Nakada
Version: 17.2.0662
Avatar

Hi,

I have a question about GoToNextWordStart method on ITextSnapshotReader.

 

For a test string "abc", I ran the below code:

ITextSnapshotReader reader = snapshot.GetReader(0);
bool gotoNextWordSuccessful = reader.GoToNextWordStart();

The results after running the above code were like this:

gotoNextWordSuccessful : true
reader.Offset          : 3
reader.IsAtSnapshotEnd : true
reader.TokenText       : null
reader.Token           : null

 

Why did GoToNextWordStart return true despite the fact that there was only one word ("abc")?

Also, why did IsAtSnapshotEnd become true, and why was Token null, even though GoToNextWordStart returned true?

 

API documentation says:

  • this method returns true if the word start is found
  • if a proper word start is not found, the reader's ITextSnapshotReader.Offset will be the end of the snapshot

 

Thanks

Comments (2)

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Ok, it should be returning false if it's at the snapshot end.  We'll update that for the next build.

The rest of it is ok though.  It should have IsAtSnapshotEnd for that scenario since it's at offset 3.


Actipro Software Support

Posted 6 years ago by Daisuke Nakada
Avatar

OK. Thank you.

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

Add Comment

Please log in to a validated account to post comments.