vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Can't copy the whole line if there is a null character in it. When trying to copy the entire line, only the part before the null character is copied.

Open ElioRay opened this issue 11 months ago • 2 comments

Does this issue occur when all extensions are disabled?: Yes

Version: 1.100.2 Electron: 34.5.1 ElectronBuildId: 11369351 Chromium: 132.0.6834.210 Node.js: 20.19.0 V8: 13.2.152.41-electron.0 OS: Windows_NT x64 10.0.19045

Steps to Reproduce:

Image

When selecting the entire line, the content after szDisposeFlag=nul is not copied.

ElioRay avatar May 22 '25 03:05 ElioRay

~~I would think copying works correctly~~ ~~but pasting will stop at the null~~

RedCMD avatar May 22 '25 05:05 RedCMD

I would think copying works correctly but pasting will stop at the null

I copied text from Notepad and pasted it into VS Code — everything looked fine, although the NUL character seemed to be ignored. However, when I copied the same text from VS Code and pasted it into Notepad, only the part before the NUL character was pasted.

ElioRay avatar May 22 '25 06:05 ElioRay

Hi thanks for filing the issue. Could you please paste here the exact text which you were copying/pasting as well as your settings file? I am currently not able to reproduce.

https://github.com/user-attachments/assets/fcb1abe4-3aac-4dae-872d-960e8851147c

aiday-mar avatar Jun 10 '25 10:06 aiday-mar

Hi thanks for filing the issue. Could you please paste here the exact text which you were copying/pasting as well as your settings file? I am currently not able to reproduce.

Screen.Recording.2025-06-10.at.12.22.33.mov

NUL is a special character in the ASCII character set, rather than the word 'null'.

ElioRay avatar Jun 11 '25 12:06 ElioRay

Hi thanks for filing the issue. Could you please paste here the exact text which you were copying/pasting as well as your settings file? I am currently not able to reproduce.

Screen.Recording.2025-06-10.at.12.22.33.mov

I'm unable to provide the text at the moment since I can't copy it, but I’ll upload the file later.

ElioRay avatar Jun 11 '25 12:06 ElioRay

Here is the file

test.txt

If the null character is not visible, please enable the display of control characters. Once enabled, the null character will become visible. Image When you copy the entire first line and paste it, the second line will be produced.

Image

ElioRay avatar Jun 11 '25 12:06 ElioRay

Ran into the same problem when trying to read some trace-files: Error-messages hat NUL-characters in them and wanted to look at those lines in isolation -> no way of copying them over. It is a major bug if a text-editor can not copy valid text.

casurin avatar Nov 12 '25 08:11 casurin

hi, same issue toggling the "view toggle control characters" for me replaces the characters with the replacement characters but still cannot copy them. i think this just a system limitation but would be nice if vscode let skip the null characters https://learn.microsoft.com/en-us/windows/win32/dataxchg/standard-clipboard-formats where there is null maybe replace with � and keep copying

Distort-Cubic avatar Dec 21 '25 18:12 Distort-Cubic