Fix bug with smart highlight of data and end-of-file

Fix #8908, close #8911
pull/8944/head
Scott Sumner 2020-09-27 09:01:31 -04:00 committed by Don HO
parent 9ab554a129
commit a08784fa43
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
1 changed files with 3 additions and 3 deletions

View File

@ -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<UINT>(pHighlightView->execute(SCI_GETCODEPAGE));