From a08784fa43376954255201982aace30dd28e0b64 Mon Sep 17 00:00:00 2001 From: Scott Sumner <30118311+sasumner@users.noreply.github.com> Date: Sun, 27 Sep 2020 09:01:31 -0400 Subject: [PATCH] Fix bug with smart highlight of data and end-of-file Fix #8908, close #8911 --- PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp b/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp index b9f0a6f8a..0ea7735b2 100644 --- a/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp +++ b/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp @@ -127,7 +127,7 @@ void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView, Scintil auto curPos = pHighlightView->execute(SCI_GETCURRENTPOS); auto range = pHighlightView->getSelection(); - int textlen = range.cpMax - range.cpMin + 1; + int textlen = range.cpMax - range.cpMin; // Determine mode for SmartHighlighting bool isWordOnly = true; @@ -162,8 +162,8 @@ void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView, Scintil return; } - char * text2Find = new char[textlen]; - pHighlightView->getSelectedText(text2Find, textlen, false); //do not expand selection (false) + char * text2Find = new char[textlen + 1]; + pHighlightView->getSelectedText(text2Find, textlen + 1, false); //do not expand selection (false) WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(pHighlightView->execute(SCI_GETCODEPAGE));