aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorZufu Liu <unknown>2017-10-15 09:32:54 +1100
committerZufu Liu <unknown>2017-10-15 09:32:54 +1100
commit2cfc6e7df00f17f8bb2fade876e2ae2220e2e51e (patch)
treef1e345952dc513e8efdc27447c6f37cd3ca44cea
parentb3352da038cb3869640f942d94fc158d1af73a9c (diff)
downloadscintilla-mirror-2cfc6e7df00f17f8bb2fade876e2ae2220e2e51e.tar.gz
Backport: Bug [#1977]. Folder treats triple-quoted f-strings like triple-quoted strings.
Backport of changeset 6399:2a06100a1fdc.
-rw-r--r--doc/ScintillaHistory.html4
-rw-r--r--lexers/LexPython.cxx6
2 files changed, 7 insertions, 3 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 30d4e1140..2929b5dd1 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -576,6 +576,10 @@
<a href="http://sourceforge.net/p/scintilla/bugs/1966/">Bug #1966</a>.
</li>
<li>
+ The Python folder treats triple-quoted f-strings like triple-quoted strings.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1977/">Bug #1977</a>.
+ </li>
+ <li>
The SQL lexer uses sql.backslash.escapes for double quoted strings.
<a href="http://sourceforge.net/p/scintilla/bugs/1968/">Bug #1968</a>.
</li>
diff --git a/lexers/LexPython.cxx b/lexers/LexPython.cxx
index 9b54340de..abe1c4be2 100644
--- a/lexers/LexPython.cxx
+++ b/lexers/LexPython.cxx
@@ -836,7 +836,7 @@ static bool IsCommentLine(Sci_Position line, Accessor &styler) {
static bool IsQuoteLine(Sci_Position line, const Accessor &styler) {
const int style = styler.StyleAt(styler.LineStart(line)) & 31;
- return ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE));
+ return IsPyTripleQuoteStringState(style);
}
@@ -872,7 +872,7 @@ void SCI_METHOD LexerPython::Fold(Sci_PositionU startPos, Sci_Position length, i
int prev_state = SCE_P_DEFAULT & 31;
if (lineCurrent >= 1)
prev_state = styler.StyleAt(startPos - 1) & 31;
- int prevQuote = options.foldQuotes && ((prev_state == SCE_P_TRIPLE) || (prev_state == SCE_P_TRIPLEDOUBLE));
+ int prevQuote = options.foldQuotes && IsPyTripleQuoteStringState(prev_state);
// Process all characters to end of requested range or end of any triple quote
//that hangs over the end of the range. Cap processing in all cases
@@ -889,7 +889,7 @@ void SCI_METHOD LexerPython::Fold(Sci_PositionU startPos, Sci_Position length, i
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
Sci_Position lookAtPos = (styler.LineStart(lineNext) == styler.Length()) ? styler.Length() - 1 : styler.LineStart(lineNext);
const int style = styler.StyleAt(lookAtPos) & 31;
- quote = options.foldQuotes && ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE));
+ quote = options.foldQuotes && IsPyTripleQuoteStringState(style);
}
const int quote_start = (quote && !prevQuote);
const int quote_continue = (quote && prevQuote);