| 16 | #include <utility> // for swap |
| 17 | |
| 18 | qsizetype 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 | |
| 42 | qsizetype Selection::lastPosInLine(LineRef l) const |
| 43 | { |
no test coverage detected