Commit 253cc3bb authored by Antonio Rojas's avatar Antonio Rojas
Browse files

Fix on-the-fly spell checking with recent Qt

Qt commit 3a273ac47f20e82a1f2f63411b210025ca0f4495 changed the behavior of lastIndexOf, so it now starts matching the zero-length regexps from the end of the string.

This made the regexp '\b' match the end of the string, making the spell checker think that every character is a word by itself.

Fix it by ignoring the last character of the string when searching for the word boundary.

BUG: 436004
parent 8b3b40e1
......@@ -538,9 +538,9 @@ KTextEditor::Range KateOnTheFlyChecker::findWordBoundaries(const KTextEditor::Cu
int translatedColumn = m_document->computePositionWrtOffsets(encToDecOffsetList, startColumn);
QString text = decodedLineText.mid(0, translatedColumn);
boundaryStart.setLine(startLine);
int match = text.lastIndexOf(boundaryQuoteRegExp);
int match = text.lastIndexOf(boundaryQuoteRegExp, -2);
if (match < 0) {
match = text.lastIndexOf(boundaryRegExp);
match = text.lastIndexOf(boundaryRegExp, -2);
}
boundaryStart.setColumn(m_document->computePositionWrtOffsets(decToEncOffsetList, qMax(0, match)));
// and now the end position
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment