(state: EditorView["state"])
| 41 | } |
| 42 | |
| 43 | function getCurrentSelectionLineRange(state: EditorView["state"]): { |
| 44 | from: number; |
| 45 | to: number; |
| 46 | } { |
| 47 | const selection = state.selection.main; |
| 48 | const startLine = state.doc.lineAt(selection.from); |
| 49 | const endPos = selection.empty |
| 50 | ? selection.head |
| 51 | : Math.max(selection.to - 1, selection.from); |
| 52 | const endLine = state.doc.lineAt(endPos); |
| 53 | const startRange = getLineSelectionRange(state, startLine); |
| 54 | const endRange = getLineSelectionRange(state, endLine); |
| 55 | |
| 56 | return { |
| 57 | from: startRange?.from ?? selection.from, |
| 58 | to: endRange?.to ?? selection.to, |
| 59 | }; |
| 60 | } |
| 61 | |
| 62 | function createLineSelection(range: { |
| 63 | from: number; |
no test coverage detected