From 655575eb77049bf2d37fa7a45115ea63c1bf7e06 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Tue, 7 May 2024 12:10:57 -0400 Subject: [PATCH] Monaco / Scaffold: Use LF line endings on all platforms https://forums.zotero.org/discussion/114239/z7-beta77-scaffold-bugs-report --- chrome/content/scaffold/monaco/monaco.html | 2 ++ chrome/content/scaffold/scaffold.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/chrome/content/scaffold/monaco/monaco.html b/chrome/content/scaffold/monaco/monaco.html index c8fe052d17..bb22881191 100644 --- a/chrome/content/scaffold/monaco/monaco.html +++ b/chrome/content/scaffold/monaco/monaco.html @@ -62,6 +62,8 @@ detectIndentation: false, ...params }); + + editor.getModel().setEOL(monaco.editor.EndOfLineSequence.LF); window.onresize = function () { editor.layout(); diff --git a/chrome/content/scaffold/scaffold.js b/chrome/content/scaffold/scaffold.js index ae5a11e7e4..1305b58b4c 100644 --- a/chrome/content/scaffold/scaffold.js +++ b/chrome/content/scaffold/scaffold.js @@ -285,7 +285,8 @@ var Scaffold = new function () { // For some reason, even if we explicitly re-set the default model's language to JavaScript, // Monaco still treats it as TypeScript. Recreating the model manually fixes the issue. - editor.setModel(monaco.editor.createModel('', 'javascript', monaco.Uri.parse('inmemory:///translator.js'))); + let model = monaco.editor.createModel('', 'javascript', monaco.Uri.parse('inmemory:///translator.js')); + editor.setModel(model); editor.updateOptions({ lineNumbers: num => num + _linesOfMetadata - 1,