fix: monaco editor glitches fixed

This commit is contained in:
2026-06-30 21:24:08 +02:00
parent ba9634c478
commit 5f77641f3f
5 changed files with 16446 additions and 19 deletions

View File

@@ -26,6 +26,20 @@ export const MonacoEditor = {
const value = this.textarea.value || "";
// ponytail: ignore the server echoing back our own last-emitted value;
// only a genuinely remote value (translation switch, etc.) should reset
// the editor. Otherwise mid-typing echoes clobber the cursor to offset 0.
if (value === this.lastKnownValue) {
return;
}
// While the user is actively typing, Monaco owns the content. Never let a
// server re-render (autosave, dirty toggle, metadata) yank it out from
// under the cursor — reconcile only once the editor is blurred.
if (this.editor.hasTextFocus()) {
return;
}
if (this.editor.getValue() !== value) {
this.isApplyingRemoteUpdate = true;
this.editor.setValue(value);