fix: error when insert completion word

This commit is contained in:
royqh1979 2021-09-01 17:44:28 +08:00
parent 8e3c85e027
commit 9fab69b08f
1 changed files with 1 additions and 5 deletions

View File

@ -1223,10 +1223,8 @@ BufferCoord SynEdit::WordStartEx(const BufferCoord &XY)
QString Line = mLines->getString(CY - 1);
CX = std::min(CX, Line.length()+1);
if (CX > 1) {
if (isWordChar(Line[CX - 1]))
if (isWordChar(Line[CX - 2]))
CX = StrRScanForNonWordChar(Line, CX - 1) + 1;
else
CX = StrRScanForWordChar(Line, CX - 1) + 1;
}
}
return BufferCoord{CX,CY};
@ -1247,8 +1245,6 @@ BufferCoord SynEdit::WordEndEx(const BufferCoord &XY)
if (CX <= Line.length()) {
if (isWordChar(Line[CX - 2]))
CX = StrScanForNonWordChar(Line, CX);
else
CX = StrScanForWordChar(Line, CX);
if (CX == 0)
CX = Line.length() + 1;
}