feat: F4.6f2 the text editor on the document's Y.Text, files both ways while the simulation runs

Oracle TextEditorWindowRun uses Java's text editor window and its file
dialog as a person does. The open file's text is its Y.Text in the
document (plan 7.3): typed is in the file at once, for everyone and for
the running engine. Core openText/saveTextAs without Java's mistakes
(lost saves after save-as onto a file or a removed file, files named
'ordner/d.txt' or ''); doc files.ts (changeFiles, fileText, nodeFiles,
readFilesInto); the room takes a person's files into the engine at once
and writes the engine's files back at the tick they changed; the editor's
window, Java's dialog, the text area following others' changes with the
caret in place, its own undo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-03 17:50:27 +00:00
co-authored by Claude Opus 5.5
parent 3d6655e736
commit 2c7733b575
29 changed files with 3268 additions and 76 deletions
+27
View File
@@ -23,6 +23,7 @@ import {
renameEntry,
saveText,
saveTextAs,
openText,
VirtualFileSystem,
type Clipboard,
type PageLanguage,
@@ -238,4 +239,30 @@ describe('the file programs beyond the cases', () => {
expect(imageFile(files, '/text.txt')).toBeUndefined();
expect(imageFile(files, '/fehlt.png')).toBeUndefined();
});
// Measured with TextEditorWindowRun (packages/sim/test/textEditorWindow.java.json).
it("opens a text file by the dialog's folder and name, in any case, and neither an image nor what is not there", () => {
const files = new VirtualFileSystem();
files.writeTextFile('/notiz.txt', 'Hallo');
files.createDirectory('/ordner');
files.writeTextFile('/ordner/b.txt', '');
files.writeImageFile('/bild.png', new Uint8Array([1]), 'image/png');
expect(openText(files, '/', 'NOTIZ.TXT')).toEqual({ path: '/notiz.txt', text: 'Hallo' });
expect(openText(files, '/', 'ordner/b.txt')).toEqual({ path: '/ordner/b.txt', text: '' });
expect(openText(files, '/ordner', '../notiz.txt')).toEqual({ path: '/notiz.txt', text: 'Hallo' });
expect(openText(files, '/ordner', '/notiz.txt')).toEqual({ path: '/notiz.txt', text: 'Hallo' });
expect(['fehlt.txt', '', 'ordner'].map((name) => openText(files, '/', name))).toEqual(['notFound', 'notFound', 'notFound']);
expect(openText(files, '/', 'bild.png')).toBe('notText');
});
it('saves as a name leading into a folder, and not as an empty name, one with blanks at its ends or one whose folder is missing', () => {
const files = new VirtualFileSystem();
files.createDirectory('/ordner');
expect(saveTextAs(files, '/', 'ordner/d.txt', 'd')).toBe('saved');
expect(files.textFile('/ordner/d.txt')).toBe('d');
expect(['', ' x.txt', 'x.txt ', 'ordner/ e.txt', '..'].map((name) => saveTextAs(files, '/ordner', name, 'x'))).toEqual(['invalidName', 'invalidName', 'invalidName', 'invalidName', 'invalidName']);
expect(saveTextAs(files, '/', 'fehlt/e.txt', 'e')).toBe('folderMissing');
expect(saveTextAs(files, '/', 'ORDNER', 'e')).toBe('isFolder');
expect(files.allEntries().map((entry) => entry.path)).toEqual(['/', '/ordner', '/ordner/d.txt']);
});
});