- fix: only highlight fully selected word
This commit is contained in:
parent
72b8d51092
commit
acbb7c06b8
|
@ -222,6 +222,8 @@ private:
|
|||
QString mCurrentWord;
|
||||
QString mCurrentDebugTipWord;
|
||||
TipType mCurrentTipType;
|
||||
QString mOldSelectionWord;
|
||||
QString mSelectionWord;
|
||||
|
||||
// QWidget interface
|
||||
protected:
|
||||
|
|
|
@ -122,4 +122,6 @@ int StrRScanForNonWordChar(const QString& s, int startPos);
|
|||
|
||||
void ensureNotAfter(BufferCoord& cord1, BufferCoord& cord2);
|
||||
|
||||
bool isWordChar(const QChar& ch);
|
||||
|
||||
#endif // MISCPROCS_H
|
||||
|
|
|
@ -1221,9 +1221,9 @@ BufferCoord SynEdit::WordStartEx(const BufferCoord &XY)
|
|||
// valid line?
|
||||
if ((CY >= 1) && (CY <= mLines->count())) {
|
||||
QString Line = mLines->getString(CY - 1);
|
||||
CX = std::min(CX, Line.length());
|
||||
if (CX-1 >= 0) {
|
||||
if (!(Line[CX - 1].isSpace()))
|
||||
CX = std::min(CX, Line.length()+1);
|
||||
if (CX > 1) {
|
||||
if (isWordChar(Line[CX - 1]))
|
||||
CX = StrRScanForNonWordChar(Line, CX - 1) + 1;
|
||||
else
|
||||
CX = StrRScanForWordChar(Line, CX - 1) + 1;
|
||||
|
@ -1245,7 +1245,7 @@ BufferCoord SynEdit::WordEndEx(const BufferCoord &XY)
|
|||
if ((CY >= 1) && (CY <= mLines->count())) {
|
||||
QString Line = mLines->getString(CY - 1);
|
||||
if (CX <= Line.length()) {
|
||||
if (!(Line[CX - 1].isSpace()))
|
||||
if (isWordChar(Line[CX - 2]))
|
||||
CX = StrScanForNonWordChar(Line, CX);
|
||||
else
|
||||
CX = StrScanForWordChar(Line, CX);
|
||||
|
|
Loading…
Reference in New Issue