Internal setText that doesn't reset history state - used by navigateHistory
(text: string, cursorPlacement: "start" | "end" = "end")
| 531 | |
| 532 | /** Internal setText that doesn't reset history state - used by navigateHistory */ |
| 533 | private setTextInternal(text: string, cursorPlacement: "start" | "end" = "end"): void { |
| 534 | const lines = text.split("\n"); |
| 535 | this.state.lines = lines.length === 0 ? [""] : lines; |
| 536 | this.state.cursorLine = cursorPlacement === "start" ? 0 : this.state.lines.length - 1; |
| 537 | this.setCursorCol(cursorPlacement === "start" ? 0 : this.state.lines[this.state.cursorLine]?.length || 0); |
| 538 | // Reset scroll - render() will adjust to show cursor |
| 539 | this.scrollOffset = 0; |
| 540 | |
| 541 | if (this.onChange) { |
| 542 | this.onChange(this.getText()); |
| 543 | } |
| 544 | } |
| 545 | |
| 546 | invalidate(): void { |
| 547 | // No cached state to invalidate currently |
no test coverage detected