From 942bb0e4189c864760a320908fc962c947ecd32e Mon Sep 17 00:00:00 2001 From: zufuliu Date: Sun, 18 Aug 2024 22:07:38 +0800 Subject: [PATCH] [Dart] Fix simple string interpolation highlighting, issue #806. --- scintilla/lexers/LexDart.cxx | 15 +++++++++------ scintilla/lexers/LexFortran.cxx | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/scintilla/lexers/LexDart.cxx b/scintilla/lexers/LexDart.cxx index 3574569e11..714a52a09d 100644 --- a/scintilla/lexers/LexDart.cxx +++ b/scintilla/lexers/LexDart.cxx @@ -174,8 +174,15 @@ void ColouriseDartDoc(Sci_PositionU startPos, Sci_Position lengthDoc, int initSt } else { char s[128]; sc.GetCurrent(s, sizeof(s)); - const int state = sc.state; - if (keywordLists[KeywordIndex_Keyword].InList(s)) { + const bool keyword = keywordLists[KeywordIndex_Keyword].InList(s); + if (sc.state == SCE_DART_IDENTIFIER_NODOLLAR) { + if (keyword) { // built-in identifier or this + sc.ChangeState(SCE_DART_WORD); + } + sc.SetState(escSeq.outerState); + continue; + } + if (keyword) { sc.ChangeState(SCE_DART_WORD); if (StrEqualsAny(s, "import", "part")) { if (visibleChars == sc.LengthCurrent()) { @@ -238,10 +245,6 @@ void ColouriseDartDoc(Sci_PositionU startPos, Sci_Position lengthDoc, int initSt if (sc.state != SCE_DART_WORD && sc.ch != '.') { kwType = KeywordType::None; } - if (state == SCE_DART_IDENTIFIER_NODOLLAR) { - sc.SetState(escSeq.outerState); - continue; - } } sc.SetState(SCE_DART_DEFAULT); diff --git a/scintilla/lexers/LexFortran.cxx b/scintilla/lexers/LexFortran.cxx index 7c2399d0d9..243102ee34 100644 --- a/scintilla/lexers/LexFortran.cxx +++ b/scintilla/lexers/LexFortran.cxx @@ -183,7 +183,7 @@ void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position lengthDoc, int ini kwType = KeywordType::Function; } else if (state == SCE_F_FOLDING_WORD) { if (StrEqual(s, "if")) { - state = SCE_F_WORD; + state = SCE_F_WORD; ifConstruct = prevWord != KeywordType::Else; } else if (StrEqual(s, "type")) { if (chNext == '(' || prevWord == KeywordType::Select) {