add new getCursor and getLines methods to editor (#201)

This commit is contained in:
Markus Ylisiurunen 2025-12-16 21:13:43 +02:00 committed by GitHub
parent deee1c2952
commit 4b04c87b3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 36 additions and 0 deletions

View file

@ -595,6 +595,14 @@ export class Editor implements Component {
return this.state.lines.join("\n");
}
getLines(): string[] {
return [...this.state.lines];
}
getCursor(): { line: number; col: number } {
return { line: this.state.cursorLine, col: this.state.cursorCol };
}
setText(text: string): void {
this.historyIndex = -1; // Exit history browsing mode
this.setTextInternal(text);