MCPcopy Create free account
hub / github.com/midrender/revideo / processSelection

Method processSelection

packages/2d/src/lib/code/CodeCursor.ts:398–430  ·  view source on GitHub ↗
(
    selection: {before: number | null; after: number | null},
    skipAhead: number,
    hasOffset: boolean,
    stringLength: number,
    y: number,
  )

Source from the content-addressed store, hash-verified

396 }
397
398 private processSelection(
399 selection: {before: number | null; after: number | null},
400 skipAhead: number,
401 hasOffset: boolean,
402 stringLength: number,
403 y: number,
404 ): boolean {
405 let shouldBreak = false;
406 let currentSelected = this.isSelected(
407 (hasOffset ? this.beforeCursor.x + stringLength : stringLength) +
408 skipAhead,
409 this.beforeCursor.y + y,
410 );
411 if (selection.before !== null && selection.before !== currentSelected) {
412 shouldBreak = true;
413 } else {
414 selection.before = currentSelected;
415 }
416
417 currentSelected = this.isSelected(
418 (hasOffset ? this.afterCursor.x + stringLength : stringLength) +
419 skipAhead,
420 this.afterCursor.y + y,
421 true,
422 );
423 if (selection.after !== null && selection.after !== currentSelected) {
424 shouldBreak = true;
425 } else {
426 selection.after = currentSelected;
427 }
428
429 return shouldBreak;
430 }
431
432 private isSelected(x: number, y: number, isAfter?: boolean): number {
433 const point: CodePoint = [y, x];

Callers 1

drawTokenMethod · 0.95

Calls 1

isSelectedMethod · 0.95

Tested by

no test coverage detected