( selection: EditorSelection, )
| 427 | * @returns [start, end] positions |
| 428 | */ |
| 429 | export function normalizeSelection( |
| 430 | selection: EditorSelection, |
| 431 | ): readonly [CursorPosition, CursorPosition] { |
| 432 | const { anchor, active } = selection; |
| 433 | |
| 434 | if ( |
| 435 | anchor.line < active.line || |
| 436 | (anchor.line === active.line && anchor.column <= active.column) |
| 437 | ) { |
| 438 | return Object.freeze([anchor, active]); |
| 439 | } |
| 440 | return Object.freeze([active, anchor]); |
| 441 | } |
| 442 | |
| 443 | /** |
| 444 | * Get selected text from lines. |
no outgoing calls
no test coverage detected