Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Diff editor copies the wrong deleted line #4743

Open
1 of 2 tasks
pzdr7 opened this issue Nov 6, 2024 · 0 comments
Open
1 of 2 tasks

[Bug] Diff editor copies the wrong deleted line #4743

pzdr7 opened this issue Nov 6, 2024 · 0 comments

Comments

@pzdr7
Copy link

pzdr7 commented Nov 6, 2024

Reproducible in vscode.dev or in VS Code Desktop?

  • Not reproducible in vscode.dev or VS Code Desktop

Reproducible in the monaco editor playground?

Monaco Editor Playground Link

https://microsoft.github.io/monaco-editor/playground.html?source=v0.52.0#XQAAAAI-AgAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscw0uYPhVciAJM8XEuX7Os378jBGtVLkr6ryuhqvky-XZ9Sy0vyFSI1m9lYQpwqOsaKmhydYWIo-9hGbv_4wlPJJNj2s0fBlAbpnWQKRQl_KqfjZ7Y8b4i7lnJlWuxghO45uGGUR8VM5jAvPsH3I2NM3W9K9BnAQavyEibsHrEfRInKDkV6AWa7Y66W6xPeWpYo8pTTNmXxGVjEoPjIrqcqJvKmzwkU0_mpy27Z7xmlsV6AIkiP2ykHXMabDIeclXQVe9icS1wY262RCVnffcUWD6Lww58FtLwijorztBuhMplXhL917hhNRarAO51l2NGdNwfuJtF0cFLIjXyjRPMeX__YNQtI

Monaco Editor Playground Code

const originalModel = monaco.editor.createModel(
	/* set from `originalModel`: */ `test
first deleted line
second deleted line
third deleted line
test end
`
);
const modifiedModel = monaco.editor.createModel(
	/* set from `modifiedModel`: */ `test
test end
`,
	"text/plain"
);

const diffEditor = monaco.editor.createDiffEditor(
	document.getElementById("container"),
	{
		automaticLayout: true,
		renderSideBySide: false,
	}
);
diffEditor.setModel({
	original: originalModel,
	modified: modifiedModel,
});

Reproduction Steps

  1. Ensure that the diff is not rendered side by side.
  2. Click on the text "first deleted line" in the diff.
  3. When the menu appears, click "Copy deleted line (2)"
  4. Paste the text you copied somewhere.

Actual (Problematic) Behavior

The editor copies the wrong line to the clipboard. Selecting the line that reads "first deleted line" will instead copy "second deleted line". (Similarly, selecting the second deleted line will copy "third deleted line")

Expected Behavior

The editor should copy the line the user selects. In the example above, I would expect "first deleted line" to be copied to the clipboard.

Additional Context

2024-11-06.18-20-17.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant