telesoho / vscode-markdown-paste-image

Smartly paste for Markdown.
MIT License
135 stars 41 forks source link

"Insert extra newline when calling pasteCode" and potential fix #52

Closed anselmwang closed 1 year ago

anselmwang commented 2 years ago

Hi,

Thanks for the great vscode extension!

I find a strange issue in Window 10 vscode. I copied 2 lines of python code from VSCode

        screen_width = self.winfo_screenwidth()
        screen_height = self.winfo_screenheight()

After calling "Markdown Paste Code", it automatically insert one additional newline between each line of code.

        screen_width = self.winfo_screenwidth()

        screen_height = self.winfo_screenheight()

I debug the pasteCode() and if I print the content returned by var content = clipboard.readSync(); with console.log(JSON.stringify(content)), the result is

" screen_width = self.winfo_screenwidth()\r\r\n screen_height = self.winfo_screenheight()"

I installed latest "clipboardy" and run following code in node.js, the result is correct

> const clipboard = await import("clipboardy")
> clipboard.default.readSync()
'        screen_width = self.winfo_screenwidth()\r\n' +
  '        screen_height = self.winfo_screenheight()'

So I guess this is a bug of old clipboardy.

I am not able to fix the bug because master branch doesn't contain Markdown Paste Code. May I know if you can check in the latest code? I can help to fix the bug.

Thanks, anselmwang

telesoho commented 2 years ago

@anselmwang Thank you for your reminder, I forgot to push the code before.

dnabb commented 2 years ago

Hello,

This issue still seems to be present (v0.19.0)