| 21 | #endif |
| 22 | |
| 23 | void SelectionPosition::MoveForInsertDelete(bool insertion, int startChange, int length) { |
| 24 | if (insertion) { |
| 25 | if (position == startChange) { |
| 26 | int virtualLengthRemove = std::min(length, virtualSpace); |
| 27 | virtualSpace -= virtualLengthRemove; |
| 28 | position += virtualLengthRemove; |
| 29 | } else if (position > startChange) { |
| 30 | position += length; |
| 31 | } |
| 32 | } else { |
| 33 | if (position == startChange) { |
| 34 | virtualSpace = 0; |
| 35 | } |
| 36 | if (position > startChange) { |
| 37 | int endDeletion = startChange + length; |
| 38 | if (position > endDeletion) { |
| 39 | position -= length; |
| 40 | } else { |
| 41 | position = startChange; |
| 42 | virtualSpace = 0; |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | bool SelectionPosition::operator <(const SelectionPosition &other) const { |
| 49 | if (position == other.position) |