MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / normalizeSelection

Function normalizeSelection

packages/core/src/widgets/codeEditor.ts:429–441  ·  view source on GitHub ↗
(
  selection: EditorSelection,
)

Source from the content-addressed store, hash-verified

427 * @returns [start, end] positions
428 */
429export 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.

Callers 4

routeCodeEditorKeyDownFunction · 0.85
deleteRangeFunction · 0.85
getSelectedTextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected