mwolff added a comment.
some nits, otherwise lgtm assuming all tests pass bonus points for a proper benchmark that shows the before/after gain in hard numbers INLINE COMMENTS > kateviewaccessible.h:191 > { > - int pos = 0; > - for (int line = 0; line < cursor.line(); ++line) { > - // length of the line plus newline > - pos += view->view()->document()->line(line).size() + 1; > + int pos = m_lastPosition; > + const KTextEditor::Document *doc = view->view()->document(); I know the old code used int already, but shouldn't this better be a quint64 as it's a file offset? > kateviewaccessible.h:192 > + int pos = m_lastPosition; > + const KTextEditor::Document *doc = view->view()->document(); > + const auto *doc = > kateviewaccessible.h:204 > + m_lastView = view; > } > + else { style: join with next line > kateviewaccessible.h:215 > + pos += cursor.line() - m_lastCursor.line(); > + } > + else { dito > kateviewaccessible.h:231 > private: > + > inline KateViewInternal *view() const unrelated change? > kateviewaccessible.h:270 > + mutable KTextEditor::Cursor m_lastCursor; > + // m_lastPosition stores the positionFromCursor, with the cursor always > in column 0 > + mutable int m_lastPosition; maybe also mention that this is a file offset? REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D12016 To: jtamate, #kate, cullmann, #frameworks Cc: mwolff, brauch, cullmann, #frameworks, michaelh, kevinapavew, ngraham, bruns, demsking, sars, dhaumann