Neil Hodgson
2013-08-20 05:58:55 UTC
A new API, SCI_POSITIONRELATIVE, was implemented to optimize navigating by characters.
A document encoded in UTF-8 or DBCS may use multiple bytes for some characters. An application or platform may work with characters instead of bytes and there is a need to translate between the character-oriented view and Scintilla's byte-oriented view. For example, a compiler may report a warning for characters 12 to 18 inclusive on line 5. Previously, the SCI_POSITIONAFTER or SCI_POSITIONBEFORE methods could be called multiple times to navigate from the start of line 5 to character 12 on that line and then to (the end of) character 18. SCI_POSITIONRELATIVE avoids the loop and calling overhead.
Several platforms that Scintilla runs on use UTF-16 and treat non-BMP characters as 2 characters. It may simplify client code on these platforms to provide another API similar to SCI_POSITIONRELATIVE but which treats non-BMP characters as 2 characters to match the platform.
Here's an example interfacing to a spell checker that reports ranges in terms of UTF-16 code units where the non-BMP horse character ð confuses the position of the second mistake.
Neil
A document encoded in UTF-8 or DBCS may use multiple bytes for some characters. An application or platform may work with characters instead of bytes and there is a need to translate between the character-oriented view and Scintilla's byte-oriented view. For example, a compiler may report a warning for characters 12 to 18 inclusive on line 5. Previously, the SCI_POSITIONAFTER or SCI_POSITIONBEFORE methods could be called multiple times to navigate from the start of line 5 to character 12 on that line and then to (the end of) character 18. SCI_POSITIONRELATIVE avoids the loop and calling overhead.
Several platforms that Scintilla runs on use UTF-16 and treat non-BMP characters as 2 characters. It may simplify client code on these platforms to provide another API similar to SCI_POSITIONRELATIVE but which treats non-BMP characters as 2 characters to match the platform.
Here's an example interfacing to a spell checker that reports ranges in terms of UTF-16 code units where the non-BMP horse character ð confuses the position of the second mistake.
Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.