( selection: Selection, start: Position, end: Position )
| 10 | } |
| 11 | |
| 12 | export function selectionFromPositions( |
| 13 | selection: Selection, |
| 14 | start: Position, |
| 15 | end: Position |
| 16 | ): Selection { |
| 17 | // The built in isReversed is bugged on empty selection. don't use |
| 18 | return isForward(selection) |
| 19 | ? new Selection(start, end) |
| 20 | : new Selection(end, start); |
| 21 | } |
| 22 | |
| 23 | export function isForward(selection: Selection) { |
| 24 | return selection.active.isAfterOrEqual(selection.anchor); |
no test coverage detected