DarrenOfficial / dpaste

The Django project driving dpaste.org
https://dpaste.org
MIT License
532 stars 123 forks source link

Remove extra formatting when copying and pasting from dpaste #224

Closed some1ataplace closed 1 year ago

some1ataplace commented 1 year ago

SyntaxError: invalid character in identifier

SyntaxError: invalid syntax

error: cannot format : '\u200b'

Whenever I copy and paste from dpaste into a text editor (xed) then run the code, there is some sort of extra formatting applied to newlines by itself usually. There may be other instances where extra formatting occurs, but I don't remember what it was.

It would be nice to remove this extra formatting from the paste so that it it can easily copy and paste into a text editor and have it return no errors. Each time I need to delete the newline characters by pressing the backspace/delete key twice manually for each newline in the code to resolve the errors.

DarrenOfficial commented 1 year ago

I don't see the extra formatting that you're talking about, afaik dpaste does not add an extra line at the end of code / pastes.

Could this be related to your issue? https://github.com/linuxmint/xed/issues/195

some1ataplace commented 1 year ago

Quite possibly the same problem but it may happen on a few other text editors so it might be worth testing. But it could be just a text editor problem only so who knows.

The extra characters show up not just at the end of the file for me like others in that issue thread mentioned, it is every time in your code you press the enter key.

For example:

print('hello world')

print('hello again')

Becomes:

print('hello world')
'\u200b'
print('hello again')
'\u200b'
DarrenOfficial commented 1 year ago

Could you try copying /raw instead, see if that zero-width characters still shows up.

Also what browser are you using?

some1ataplace commented 1 year ago

Wow I did not think about doing that with /raw. It works with /raw but with regular it does not. Firefox.