ITextSnapshotReader.GoToNextWordStart

SyntaxEditor for WPF Forum

Posted 2 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 2 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 2 years ago by Daisuke Nakada
Avatar

OK. Thank you.

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.