monaco-editor icon indicating copy to clipboard operation
monaco-editor copied to clipboard

[Bug] DiffEditor: Toggling `renderSideBySide` breaks `wordWrap` unrecoverably

Open Prinzhorn opened this issue 2 years ago • 3 comments

Reproducible in vscode.dev or in VS Code Desktop?

  • [X] Not reproducible in vscode.dev or VS Code Desktop

(I don't know, haven't used either and I don't know how to get a diff editor)

Reproducible in the monaco editor playground?

Monaco Editor Playground Code

var originalModel = monaco.editor.createModel(
	'This line is removed on the right.\njust some text\nabcd\nefgh\nSome more text\nThis line is hella loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong',
	'text/plain'
);
var modifiedModel = monaco.editor.createModel(
	'just some text\nabcz\nzzzzefgh\nSome more text.\nThis line is removed on the left.',
	'text/plain'
);

var diffEditor = monaco.editor.createDiffEditor(document.getElementById('container'), {
	wordWrap: 'on'
});

diffEditor.setModel({
	original: originalModel,
	modified: modifiedModel
});

setTimeout(() => {
    diffEditor.updateOptions({
        renderSideBySide: false,
        wordWrap: 'on'
    });

    setTimeout(() => {
        diffEditor.updateOptions({
            renderSideBySide: true,
            wordWrap: 'on'
        });
    }, 1000);
}, 1000);

Reproduction Steps

  1. Paste the above into playground
  2. Hit "run"
  3. Wait a few seconds

Actual (Problematic) Behavior

After toggling renderSideBySide wordWrap unrecoverably becomes broken (disabled) and cannot be enabled again.

Expected Behavior

wordWrap should work at all times

Additional Context

No response

Playground Link

https://microsoft.github.io/monaco-editor/playground.html?source=v0.36.1#XQAAAAK8AwAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscw4rxF7Xzf4wOPUi0R0mEihWCV4AhRfW6uUIEjM3Y7DbLylIr1uDEh-48Vup1lSNeKklvi0xT6EWWHG4Pn4qydwOKAaH844crdRB4cWQDJKZ6Cv2smc5zTiruEj6CZzg3yjQ5CxHbDQ5dtdfQ2OyiOr_aOYEOgIpFlmrCu0Xkv5ayd93zRlI9OSf9RGbwAkROL0e6Vm9y7wIIjqHpMbH6mqnrYPGinsIZPZJ56HOjvlglRdTn537prNNx0HCPsyZnhzHD8bsRKRBQQtzu8UZ4mWsfWjmy6_W6nUrUnER_--xgBLT3f_aQ_Z31gwGrP_aIYLrx900M3Eecz1DzYKJL0mROQj44NrvOtKiHD7DDXRuuDSTEZVUOl7peWbAeu8jWBRFOjqS3ti0c_kThiYwprFsGGM_0qRjHz8Xc1yW0hLxG46zWjbJ9tZKYTONH_MMaj0-VG4-8NyoqV_od2NA

Prinzhorn avatar Oct 03 '22 08:10 Prinzhorn

Bisected it using the new playground, it broke somewhere here (v0.33.0-dev.20220222) https://github.com/microsoft/vscode/compare/a0da9978b10ae0b9307c7f545b50a8500efff7eb...34cef6b03c744c2de41fedd8ef70f4ccb8ea7b60

image

This commit screams "it was me" @alexdima https://github.com/microsoft/vscode/commit/2ecb5c0b8f5a24b0310c34e90607540e565c7fee

Prinzhorn avatar Apr 08 '23 07:04 Prinzhorn

same issue

WayneGongCN avatar Jan 29 '24 15:01 WayneGongCN