Commit 2e70a390 authored by Dominik Haumann's avatar Dominik Haumann

KateScriptDocument::wordRangeAt(): reuse Document::wordRangeAt()

parent f1e2f109
......@@ -387,20 +387,7 @@ KTextEditor::Range KateScriptDocument::wordRangeAt(int line, int column)
KTextEditor::Range KateScriptDocument::wordRangeAt(const KTextEditor::Cursor& cursor)
Kate::TextLine textLine = m_document->plainKateTextLine(cursor.line());
const int len = textLine->length();
int start = cursor.column();
int end = start;
// Probably because of non-wrapping cursor mode
if (start > len)
return KTextEditor::Range::invalid();
while (start > 0 && m_document->highlight()->isInWord(textLine->at(start - 1), textLine->attribute(start - 1))) start--;
while (end < len && m_document->highlight()->isInWord(textLine->at(end), textLine->attribute(end))) end++;
return KTextEditor::Range(cursor.line(), start, cursor.line(), end);
return m_document->wordRangeAt(cursor);
QString KateScriptDocument::charAt(int line, int column)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment