diff --git a/RedPandaIDE/editor.h b/RedPandaIDE/editor.h index dcdba589..f5fe1763 100644 --- a/RedPandaIDE/editor.h +++ b/RedPandaIDE/editor.h @@ -222,6 +222,8 @@ private: QString mCurrentWord; QString mCurrentDebugTipWord; TipType mCurrentTipType; + QString mOldSelectionWord; + QString mSelectionWord; // QWidget interface protected: diff --git a/RedPandaIDE/qsynedit/MiscProcs.h b/RedPandaIDE/qsynedit/MiscProcs.h index 68b2cc6c..a1d9171a 100644 --- a/RedPandaIDE/qsynedit/MiscProcs.h +++ b/RedPandaIDE/qsynedit/MiscProcs.h @@ -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 diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index 9b4bb9c9..eb0b17b5 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -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);