From 79fe92e3d02294e451d3e537895a1d8f793ddea9 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Wed, 5 Dec 2018 09:40:12 +0100 Subject: [PATCH] + upd: merge current Scintilla dev stage --- scintilla/doc/ScintillaHistory.html | 5 +++++ scintilla/lexers/LexCPP.cxx | 30 +++++++++++++++++++---------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/scintilla/doc/ScintillaHistory.html b/scintilla/doc/ScintillaHistory.html index 9d5379468..0908fcc08 100644 --- a/scintilla/doc/ScintillaHistory.html +++ b/scintilla/doc/ScintillaHistory.html @@ -577,6 +577,11 @@ Bug #2054.
  • + The C++ lexer interprets continued preprocessor lines correctly by reading all of + the logical line. + Bug #2062. +
  • +
  • For SciTE's Find in Files, allow case-sensitivity and whole-word options when running a user defined command. Bug #2053. diff --git a/scintilla/lexers/LexCPP.cxx b/scintilla/lexers/LexCPP.cxx index 4f4a0f648..fbd3186c6 100644 --- a/scintilla/lexers/LexCPP.cxx +++ b/scintilla/lexers/LexCPP.cxx @@ -201,17 +201,27 @@ struct EscapeSequence { std::string GetRestOfLine(LexAccessor &styler, Sci_Position start, bool allowSpace) { std::string restOfLine; - Sci_Position i =0; + Sci_Position line = styler.GetLine(start); + Sci_Position pos = start; + Sci_Position endLine = styler.LineEnd(line); char ch = styler.SafeGetCharAt(start, '\n'); - const Sci_Position endLine = styler.LineEnd(styler.GetLine(start)); - while (((start+i) < endLine) && (ch != '\r')) { - const char chNext = styler.SafeGetCharAt(start + i + 1, '\n'); - if (ch == '/' && (chNext == '/' || chNext == '*')) - break; - if (allowSpace || (ch != ' ')) - restOfLine += ch; - i++; - ch = chNext; + while (pos < endLine) { + if (ch == '\\' && ((pos + 1) == endLine)) { + // Continuation line + line++; + pos = styler.LineStart(line); + endLine = styler.LineEnd(line); + ch = styler.SafeGetCharAt(pos, '\n'); + } else { + const char chNext = styler.SafeGetCharAt(pos + 1, '\n'); + if (ch == '/' && (chNext == '/' || chNext == '*')) + break; + if (allowSpace || (ch != ' ')) { + restOfLine += ch; + } + pos++; + ch = chNext; + } } return restOfLine; }