| 65 | } |
| 66 | |
| 67 | bool Selection::within(LineRef l, qsizetype p) const |
| 68 | { |
| 69 | if(!firstLine.isValid()) |
| 70 | return false; |
| 71 | |
| 72 | LineRef l1 = firstLine; |
| 73 | LineRef l2 = lastLine; |
| 74 | qsizetype p1 = firstPos; |
| 75 | qsizetype p2 = lastPos; |
| 76 | if(l1 > l2) |
| 77 | { |
| 78 | std::swap(l1, l2); |
| 79 | std::swap(p1, p2); |
| 80 | } |
| 81 | if(l1 == l2 && p1 > p2) |
| 82 | { |
| 83 | std::swap(p1, p2); |
| 84 | } |
| 85 | if(l1 <= l && l <= l2) |
| 86 | { |
| 87 | if(l1 == l2) |
| 88 | return p >= p1 && p < p2; |
| 89 | if(l == l1) |
| 90 | return p >= p1; |
| 91 | if(l == l2) |
| 92 | return p < p2; |
| 93 | return true; |
| 94 | } |
| 95 | return false; |
| 96 | } |
| 97 | |
| 98 | bool Selection::lineWithin(LineRef l) const |
| 99 | { |
no test coverage detected