diff --git a/PowerEditor/src/ScitillaComponent/AutoCompletion.cpp b/PowerEditor/src/ScitillaComponent/AutoCompletion.cpp index 97036c371..84919e83e 100644 --- a/PowerEditor/src/ScitillaComponent/AutoCompletion.cpp +++ b/PowerEditor/src/ScitillaComponent/AutoCompletion.cpp @@ -342,8 +342,8 @@ bool AutoCompletion::showWordComplete(bool autoInsert) if (wordArray.size() == 1 && autoInsert) { - _pEditView->replaceTargetRegExMode(wordArray[0].c_str(), startPos, curPos); - _pEditView->execute(SCI_GOTOPOS, startPos + wordArray[0].length()); + int replacedLength = _pEditView->replaceTargetRegExMode(wordArray[0].c_str(), startPos, curPos); + _pEditView->execute(SCI_GOTOPOS, startPos + replacedLength); return true; }