Discussion:
Removing style byte indicators
Neil Hodgson
2014-05-12 10:35:11 UTC
Permalink
Way back in 2007 'modern' indicators were introduced along with warnings that style byte indicators were deprecated, would be removed in the *next version* and should not be used by applications. I noticed today that some of the core drawing logic could be simplified and memory use decreased by removing style byte indicator support.

Hopefully everyone has removed all actual use of style byte indicators but I expect all are still calling SCI_SETSTYLEBITS, just like SciTE, using the result from SCI_GETSTYLEBITSNEEDED. Moving these functions into the deprecated category would produce a compile error. While this could indicate a problem if the application was really using style byte indicators, its almost certain that this would just break innocent code that was simply copying examples.

There may be advantages to knowing roughly how many styles are possible for the application to minimize memory use or processing. If so it may be worth continuing to return a lexer-appropriate value from SCI_GETSTYLEBITSNEEDED. An alternative would be to always return 8.

So, I'd like to change SCI_SETSTYLEBITS to perform no action and SCI_GETSTYLEBITS to always return 8. Document this new behaviour and discourage calling these functions.

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/d/optout.
Greg Smith
2014-05-16 10:25:11 UTC
Permalink
I have checked our code. We use SCI_GETSTYLEBITS to generate a mask for
styles when checking bracket matching. Your proposed change would be
transparent for us.
--
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/d/optout.
Neil Hodgson
2014-05-16 22:24:13 UTC
Permalink
Hi Greg,
I have checked our code. We use SCI_GETSTYLEBITS to generate a mask for styles when checking bracket matching. Your proposed change would be transparent for us.
OK.

This change won't be occurring until after 3.4.2 is released so there will be plenty of time to test before it is finalised.

There are 2 included lexers, PostScript and Scriptol, that use style byte indicators and I am in contact with the authors of those lexers.

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/d/optout.
Neil Hodgson
2014-05-24 05:59:10 UTC
Permalink
Style byte indicators have now been removed with change set
https://sourceforge.net/p/scintilla/code/ci/cceb0202b9ca8670cf33a8ce2fd245b0aac7bb66/

Some APIs used by lexers have changed. If you are maintaining a lexer separately and not contributing it to Scintilla then you should check soon that your lexer still works. If not you may need to make a small change. If it is not possible to make changes then tell me now as some extra compatibility could be included.

LexerModule no longer takes a styleBits_ argument as all 8 bits are always used for styles now. If your lexer has a LexerModule declaration that provides this argument then simply remove it. LexAccessor::StartAt no longer has an (optional) chMask argument: again simply remove it. LexAccessor::SetFlags has been completely removed: switch any code that uses it to use modern indicators instead. The constructor for StyleContext still allows an optional chMask parameter but this has no effect so remove this argument from any use of StyleContext.

Two lexers included with Scintilla, for PostScript and Scriptol used style byte indicators. The code implementing these has been removed by these change sets:
PostScript: https://sourceforge.net/p/scintilla/code/ci/53af9ea5f43b0ae03cd1f23583206bcca5d500d4/
Scriptol: https://sourceforge.net/p/scintilla/code/ci/c1f20d7b65c0884e8082461dea2f9664d25c5229/
The PostScript lexer used indicators to mark token starts which were then used by the wxGhostscript application. The author of wxGhostscript and the lexer has not worked on either recently and would be willing to hand over to someone interested in PostScript.
The Scriptol lexer used indicators to mark inconsistent indentation in a similar way to the Python lexer. The author of this lexer has expressed some interest in updating the lexer.

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/d/optout.
Continue reading on narkive:
Loading...