mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 01:04:36 +00:00
add new getCursor and getLines methods to editor (#201)
This commit is contained in:
parent
deee1c2952
commit
4b04c87b3d
2 changed files with 36 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue