From 4f8c51ef2e37f152640afa8565716435b256172c Mon Sep 17 00:00:00 2001
From: nyamatongwe
This pair of routines sets and reads back the number of bits in each cell to use for styling,
to a maximum of 7 style bits. The remaining bits can be used as indicators. The standard
- setting is SCI_SETSTYLEBITS(5).
SCI_SETSTYLEBITS(5).
+ The number of styling bits needed by the current lexer can be found with
+ SCI_GETSTYLEBITSNEEDED.
TextRange and CharacterRange
These structures are defined to be exactly the same shape as the Win32 TEXTRANGE
@@ -4293,6 +4295,8 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
+
+
SCI_SETLEXER(int lexer)
@@ -4402,6 +4406,11 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
There is nothing to stop you building your own keyword lists into the lexer, but this means
that the lexer must be rebuilt if more keywords are added.
SCI_GETSTYLEBITSNEEDED
+ Retrieve the number of bits the current lexer needs for styling. This should normally be the argument
+ to .
+
Notifications are sent (fired) from the Scintilla control to its container when an event has
diff --git a/include/KeyWords.h b/include/KeyWords.h
index cc81b73df..059ac0da0 100644
--- a/include/KeyWords.h
+++ b/include/KeyWords.h
@@ -20,15 +20,19 @@ protected:
LexerFunction fnLexer;
LexerFunction fnFolder;
const char * const * wordListDescriptions;
+ int styleBits;
static const LexerModule *base;
static int nextLanguage;
public:
const char *languageName;
- LexerModule(int language_, LexerFunction fnLexer_,
- const char *languageName_=0, LexerFunction fnFolder_=0,
- const char * const wordListDescriptions_[] = NULL);
+ LexerModule(int language_,
+ LexerFunction fnLexer_,
+ const char *languageName_=0,
+ LexerFunction fnFolder_=0,
+ const char * const wordListDescriptions_[] = NULL,
+ int styleBits_=5);
virtual ~LexerModule() {
}
int GetLanguage() const { return language; }
@@ -37,6 +41,8 @@ public:
int GetNumWordLists() const;
const char *GetWordListDescription(int index) const;
+ int GetStyleBitsNeeded() const;
+
virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle,
WordList *keywordlists[], Accessor &styler) const;
virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle,
diff --git a/include/Scintilla.h b/include/Scintilla.h
index 359db9c8f..cb91cba6f 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -616,6 +616,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETPROPERTY 4008
#define SCI_GETPROPERTYEXPANDED 4009
#define SCI_GETPROPERTYINT 4010
+#define SCI_GETSTYLEBITSNEEDED 4011
#define SC_MOD_INSERTTEXT 0x1
#define SC_MOD_DELETETEXT 0x2
#define SC_MOD_CHANGESTYLE 0x4
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index b7a9b7d13..652d45858 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -1670,6 +1670,9 @@ fun int GetPropertyExpanded=4009(string key, stringresult buf)
# interpreted as an int AFTER any "$()" variable replacement.
get int GetPropertyInt=4010(string key,)
+# Retrieve the number of bits the current lexer needs for styling.
+get int GetStyleBitsNeeded=4011(,)
+
# Notifications
# Type of modification and the action which caused the modification.
# These are defined as a bit mask to make it easy to specify which notifications are wanted.
diff --git a/src/KeyWords.cxx b/src/KeyWords.cxx
index d1b9614e5..f932b877e 100644
--- a/src/KeyWords.cxx
+++ b/src/KeyWords.cxx
@@ -22,14 +22,18 @@
const LexerModule *LexerModule::base = 0;
int LexerModule::nextLanguage = SCLEX_AUTOMATIC+1;
-LexerModule::LexerModule(int language_, LexerFunction fnLexer_,
- const char *languageName_, LexerFunction fnFolder_,
- const char * const wordListDescriptions_[]) :
+LexerModule::LexerModule(int language_,
+ LexerFunction fnLexer_,
+ const char *languageName_,
+ LexerFunction fnFolder_,
+ const char * const wordListDescriptions_[],
+ int styleBits_) :
language(language_),
fnLexer(fnLexer_),
fnFolder(fnFolder_),
wordListDescriptions(wordListDescriptions_),
- languageName(languageName_) {
+ languageName(languageName_),
+ styleBits(styleBits_) {
next = base;
base = this;
if (language == SCLEX_AUTOMATIC) {
@@ -52,7 +56,7 @@ int LexerModule::GetNumWordLists() const {
}
}
-const char * LexerModule::GetWordListDescription(int index) const {
+const char *LexerModule::GetWordListDescription(int index) const {
static const char *emptyStr = "";
PLATFORM_ASSERT(index < GetNumWordLists());
@@ -63,6 +67,10 @@ const char * LexerModule::GetWordListDescription(int index) const {
}
}
+int LexerModule::GetStyleBitsNeeded() const {
+ return styleBits;
+}
+
const LexerModule *LexerModule::Find(int language) {
const LexerModule *lm = base;
while (lm) {
diff --git a/src/LexHTML.cxx b/src/LexHTML.cxx
index 036bf1a8f..616b3acfd 100644
--- a/src/LexHTML.cxx
+++ b/src/LexHTML.cxx
@@ -1993,9 +1993,9 @@ static const char * const phpscriptWordListDesc[] = {
0,
};
-LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext", 0, htmlWordListDesc);
-LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml", 0, htmlWordListDesc);
+LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext", 0, htmlWordListDesc, 7);
+LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml", 0, htmlWordListDesc, 7);
// SCLEX_ASP and SCLEX_PHP should not be used in new code: use SCLEX_HTML instead.
-LexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp", 0, htmlWordListDesc);
-LexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php", 0, htmlWordListDesc);
-LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, ColourisePHPScriptDoc, "phpscript", 0, phpscriptWordListDesc);
+LexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp", 0, htmlWordListDesc, 7);
+LexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php", 0, htmlWordListDesc, 7);
+LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, ColourisePHPScriptDoc, "phpscript", 0, phpscriptWordListDesc, 7);
diff --git a/src/LexRuby.cxx b/src/LexRuby.cxx
index 878071a53..e8a4d2917 100644
--- a/src/LexRuby.cxx
+++ b/src/LexRuby.cxx
@@ -1253,4 +1253,4 @@ static const char * const rubyWordListDesc[] = {
0
};
-LexerModule lmRuby(SCLEX_RUBY, ColouriseRbDoc, "ruby", FoldRbDoc, rubyWordListDesc);
+LexerModule lmRuby(SCLEX_RUBY, ColouriseRbDoc, "ruby", FoldRbDoc, rubyWordListDesc, 6);
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx
index b650d19c5..9c88af0d6 100644
--- a/src/ScintillaBase.cxx
+++ b/src/ScintillaBase.cxx
@@ -689,7 +689,6 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
case SCI_GETPROPERTYINT:
return props.GetInt(reinterpret_cast