[ktexteditor] much faster positionFromCursor

Authored by jtamate on May 4 2018, 10:24 AM.

Description

[ktexteditor] much faster positionFromCursor

Summary:
Use mutable variables to store information about last call to positionFromCursor.
As most of the time the cursor is close to the previous position, avoid to calculate every time the size of the lines from the beginning of the document, just calculate it from the previous cursor position.

Test Plan:
Open a callgrind log file with more than 1.00.000 lines,
go to the end of the file, and then play with the PageUp, PageDown and cursor keys.
Before: it was unable to do continuous PageUp refreshes.
After: the PageUp at any part of the file is as fast as in the beginning of the document.

Reviewers: Kate, cullmann, Frameworks

Reviewed By: Kate, cullmann

Subscribers: anthonyfieroni, mwolff, brauch, cullmann, Frameworks

Tags: Kate, Frameworks

Differential Revision: https://phabricator.kde.org/D12016

Details

Committed
jtamateMay 4 2018, 10:26 AM
Reviewer
Kate
Differential Revision
D12016: [ktexteditor] much faster positionFromCursor
Parents
R39:a426f5a60ff3: Implement single click on line number to select line of text
Branches
Unknown
Tags
Unknown