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