Add cursor moving (#19)

This commit is contained in:
Andras Schmelczer 2025-04-02 22:06:38 +01:00 committed by GitHub
parent 29d8779786
commit 1f9728d893
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
49 changed files with 1105 additions and 141 deletions

View file

@ -1,5 +1,15 @@
import type { RelativePath } from "../persistence/database";
export interface Cursor {
id: number;
characterPosition: number;
}
export interface TextWithCursors {
text: string;
cursors: Cursor[];
}
export interface FileSystemOperations {
// List all files that should be synced.
listAllFiles: () => Promise<RelativePath[]>;
@ -13,7 +23,7 @@ export interface FileSystemOperations {
// Atomically update the content of a text file.
atomicUpdateText: (
path: RelativePath,
updater: (currentContent: string) => string
updater: (current: TextWithCursors) => TextWithCursors
) => Promise<string>;
// Get the size of a file in bytes.