( insideTarget: TypedSelection, outsideTarget: TypedSelection )
| 45 | |
| 46 | /** Get the possible leading and trailing overflow ranges of the outside target compared to the inside target */ |
| 47 | export function getOutsideOverflow( |
| 48 | insideTarget: TypedSelection, |
| 49 | outsideTarget: TypedSelection |
| 50 | ): TypedSelection[] { |
| 51 | const { start: insideStart, end: insideEnd } = |
| 52 | insideTarget.selection.selection; |
| 53 | const { start: outsideStart, end: outsideEnd } = |
| 54 | outsideTarget.selection.selection; |
| 55 | const result = []; |
| 56 | if (outsideStart.isBefore(insideStart)) { |
| 57 | result.push( |
| 58 | createTypeSelection( |
| 59 | insideTarget.selection.editor, |
| 60 | outsideStart, |
| 61 | insideStart |
| 62 | ) |
| 63 | ); |
| 64 | } |
| 65 | if (outsideEnd.isAfter(insideEnd)) { |
| 66 | result.push( |
| 67 | createTypeSelection(insideTarget.selection.editor, insideEnd, outsideEnd) |
| 68 | ); |
| 69 | } |
| 70 | return result; |
| 71 | } |
| 72 | |
| 73 | function createTypeSelection( |
| 74 | editor: TextEditor, |
no test coverage detected