MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / createExtendedLineSelection

Function createExtendedLineSelection

src/cm/lineNumberSelection.ts:69–82  ·  view source on GitHub ↗
(
	state: EditorView["state"],
	clickedRange: { from: number; to: number },
)

Source from the content-addressed store, hash-verified

67}
68
69function createExtendedLineSelection(
70 state: EditorView["state"],
71 clickedRange: { from: number; to: number },
72): EditorSelection {
73 const currentRange = getCurrentSelectionLineRange(state);
74 const from = Math.min(currentRange.from, clickedRange.from);
75 const to = Math.max(currentRange.to, clickedRange.to);
76
77 if (clickedRange.from <= currentRange.from) {
78 return EditorSelection.single(to, from);
79 }
80
81 return EditorSelection.single(from, to);
82}
83
84/**
85 * Select the clicked line from the line-number gutter.

Callers 1

handleLineNumberClickFunction · 0.85

Calls 1

Tested by

no test coverage detected