MCPcopy Create free account
hub / github.com/KDE/kdiff3 / firstPosInLine

Method firstPosInLine

src/selection.cpp:18–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16#include <utility> // for swap
17
18qsizetype Selection::firstPosInLine(LineRef l) const
19{
20 assert(firstLine.isValid());
21
22 LineRef l1 = firstLine;
23 LineRef l2 = lastLine;
24 qsizetype p1 = firstPos;
25 qsizetype p2 = lastPos;
26 if(l1 > l2)
27 {
28 std::swap(l1, l2);
29 std::swap(p1, p2);
30 }
31 if(l1 == l2 && p1 > p2)
32 {
33 std::swap(p1, p2);
34 }
35
36 if(l == l1)
37 return p1;
38
39 return 0;
40}
41
42qsizetype Selection::lastPosInLine(LineRef l) const
43{

Callers 2

getTextLayoutForLineMethod · 0.80
deleteSelectionMethod · 0.80

Calls 1

isValidMethod · 0.45

Tested by

no test coverage detected