diff --git a/scintilla/doc/ScintillaDoc.html b/scintilla/doc/ScintillaDoc.html index 85435a0bc..628c2c22c 100644 --- a/scintilla/doc/ScintillaDoc.html +++ b/scintilla/doc/ScintillaDoc.html @@ -273,12 +273,11 @@ ○ By character or UTF-16 code unitMultiple Selection and Virtual Space - scrolling - ○ Scrolling and automatic + ○ Scrolling and automatic scrollingWhite space diff --git a/scintilla/doc/ScintillaHistory.html b/scintilla/doc/ScintillaHistory.html index 66fcaf36b..30a99d684 100644 --- a/scintilla/doc/ScintillaHistory.html +++ b/scintilla/doc/ScintillaHistory.html @@ -567,6 +567,10 @@ Lexer added for X12. Feature #1280. +
  • + VB lexer adds support for VB2017 binary literal &B and digit separators 123_456. + Feature #1288. +
  • Improved performance of line folding code on large files when no folds are contracted. This improves the time taken to open or close large files. diff --git a/scintilla/lexers/LexVB.cxx b/scintilla/lexers/LexVB.cxx index 3b380c4fd..ceac8d2fe 100644 --- a/scintilla/lexers/LexVB.cxx +++ b/scintilla/lexers/LexVB.cxx @@ -53,7 +53,7 @@ static inline bool IsANumberChar(int ch) { // but probably enough in most cases. return (ch < 0x80) && (isdigit(ch) || toupper(ch) == 'E' || - ch == '.' || ch == '-' || ch == '+'); + ch == '.' || ch == '-' || ch == '+' || ch == '_'); } static void ColouriseVBDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, @@ -199,6 +199,10 @@ static void ColouriseVBDoc(Sci_PositionU startPos, Sci_Position length, int init // Octal number sc.SetState(SCE_B_NUMBER); sc.Forward(); + } else if (sc.ch == '&' && tolower(sc.chNext) == 'b') { + // Binary number + sc.SetState(SCE_B_NUMBER); + sc.Forward(); } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { sc.SetState(SCE_B_NUMBER); } else if (IsAWordStart(sc.ch) || (sc.ch == '[')) { diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index 947b39f6a..27b50fa12 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -5899,15 +5899,14 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { pdoc->LineStart(static_cast(wParam)); const Sci::Position lineEnd = pdoc->LineStart(static_cast(wParam + 1)); + // not NUL terminated + const Sci::Position len = lineEnd - lineStart; if (lParam == 0) { - return lineEnd - lineStart; + return len; } char *ptr = CharPtrFromSPtr(lParam); - Sci::Position iPlace = 0; - for (Sci::Position iChar = lineStart; iChar < lineEnd; iChar++) { - ptr[iPlace++] = pdoc->CharAt(iChar); - } - return iPlace; + pdoc->GetCharRange(ptr, lineStart, len); + return len; } case SCI_GETLINECOUNT: @@ -5941,10 +5940,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return selectedText.LengthWithTerminator(); } else { char *ptr = CharPtrFromSPtr(lParam); - size_t iChar = 0; - if (selectedText.Length()) { - for (; iChar < selectedText.LengthWithTerminator(); iChar++) - ptr[iChar] = selectedText.Data()[iChar]; + size_t iChar = selectedText.Length(); + if (iChar) { + memcpy(ptr, selectedText.Data(), iChar); + ptr[iChar++] = '\0'; } else { ptr[0] = '\0'; } @@ -6375,8 +6374,8 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { if (lParam == 0) return 0; Sci_TextRange *tr = static_cast(PtrFromSPtr(lParam)); - int iPlace = 0; - for (long iChar = tr->chrg.cpMin; iChar < tr->chrg.cpMax; iChar++) { + Sci::Position iPlace = 0; + for (Sci::Position iChar = tr->chrg.cpMin; iChar < tr->chrg.cpMax; iChar++) { tr->lpstrText[iPlace++] = pdoc->CharAt(iChar); tr->lpstrText[iPlace++] = pdoc->StyleAt(iChar); } @@ -6453,11 +6452,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { } PLATFORM_ASSERT(wParam > 0); char *ptr = CharPtrFromSPtr(lParam); - unsigned int iPlace = 0; - for (Sci::Position iChar = lineStart; iChar < lineEnd && iPlace < wParam - 1; iChar++) { - ptr[iPlace++] = pdoc->CharAt(iChar); - } - ptr[iPlace] = '\0'; + const Sci::Position len = std::min(lineEnd - lineStart, wParam - 1); + pdoc->GetCharRange(ptr, lineStart, len); + ptr[len] = '\0'; return sel.MainCaret() - lineStart; }