Skip to content

Add KTextEditor::LineRange

Dominik Haumann requested to merge work/kte-line-range into master

The idea is to have a range class similar to KTextEditor::Range but without column support. A LineRange simply is defined by a tuple of a start line and an end line. The API matches 1:1 the one of KTextEditor::Range but without column support.

Many locations in KTextEditor require only a start line and an end line, like tagging dirty lines for a repaint. The intention of this class is to have a better semantic of LineRanges throughout our code.

Since the class KTextEditor::LineRange is defined by two ints, it has in total 8 bytes in memory and therefore can safely be passed by value without performance issues.

For easy conversion, KTextEditor::Range::toLineRange() can be used to convert a Range to a LineRange. The same holds for a MovingRange.

Merge request reports

Loading