MCPcopy Create free account
hub / github.com/cursorless-dev/cursorless / getLineNumber

Function getLineNumber

src/actions/Scroll.ts:94–109  ·  view source on GitHub ↗
(targets: TypedSelection[], at: string)

Source from the content-addressed store, hash-verified

92}
93
94function getLineNumber(targets: TypedSelection[], at: string) {
95 let startLine = Number.MAX_SAFE_INTEGER;
96 let endLine = 0;
97 targets.forEach((t: TypedSelection) => {
98 startLine = Math.min(startLine, t.selection.selection.start.line);
99 endLine = Math.max(endLine, t.selection.selection.end.line);
100 });
101
102 if (at === "top") {
103 return startLine;
104 }
105 if (at === "bottom") {
106 return endLine;
107 }
108 return Math.floor((startLine + endLine) / 2);
109}

Callers 1

runMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected