aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ScintillaBase.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2020-04-05 21:31:33 +1000
committerNeil <nyamatongwe@gmail.com>2020-04-05 21:31:33 +1000
commitd12c83527976eb3b2fce01a4b104ab119d531bc2 (patch)
tree9ecd15acc7034b5014711ff01d9c4a8eb2a29989 /src/ScintillaBase.cxx
parente72c4af1c604bce533c68488cdb5802b461ec179 (diff)
downloadscintilla-mirror-d12c83527976eb3b2fce01a4b104ab119d531bc2.tar.gz
Implement access to the identifier of an ILexer5. This also stops unexpected
container lexing when a lexer is set.
Diffstat (limited to 'src/ScintillaBase.cxx')
-rw-r--r--src/ScintillaBase.cxx16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx
index 8e3a86c15..9180b3796 100644
--- a/src/ScintillaBase.cxx
+++ b/src/ScintillaBase.cxx
@@ -679,6 +679,18 @@ void LexState::SetWordList(int n, const char *wl) {
}
}
+int LexState::GetIdentifier() const {
+ if (lexCurrent) {
+ return lexCurrent->GetLanguage();
+ }
+ if (instance) {
+ if (instance->Version() >= lvRelease5) {
+ return instance->GetIdentifier();
+ }
+ }
+ return SCLEX_CONTAINER;
+}
+
const char *LexState::GetName() const {
if (lexCurrent) {
return lexCurrent->languageName;
@@ -847,7 +859,7 @@ const char *LexState::DescriptionOfStyle(int style) {
}
void ScintillaBase::NotifyStyleToNeeded(Sci::Position endStyleNeeded) {
- if (DocumentLexState()->lexLanguage != SCLEX_CONTAINER) {
+ if (DocumentLexState()->GetIdentifier() != SCLEX_CONTAINER) {
const Sci::Line lineEndStyled =
pdoc->SciLineFromPosition(pdoc->GetEndStyled());
const Sci::Position endStyled =
@@ -1062,7 +1074,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
break;
case SCI_GETLEXER:
- return DocumentLexState()->lexLanguage;
+ return DocumentLexState()->GetIdentifier();
case SCI_SETILEXER:
DocumentLexState()->SetInstance(reinterpret_cast<ILexer5 *>(lParam));