romannurik / SlidesCodeHighlighter

A little web app that helps you copy+paste syntax-highlighted code into slide decks.
https://romannurik.github.io/SlidesCodeHighlighter/
Apache License 2.0
1.06k stars 92 forks source link

Editor injects spaces after every second letter press in safari in some conditions #72

Closed ZacSweers closed 2 months ago

ZacSweers commented 1 year ago

Not really sure what's going on but easy to reproduce. Only seems to happen in safari

https://user-images.githubusercontent.com/1361086/229913424-1460698b-3b7a-4507-9c37-4fa2aa6db214.mov

romannurik commented 1 year ago

Hm very odd. I'll need to see if there's a new version of Monaco to update to to fix this?

romannurik commented 1 year ago

Finally got around to trying this out, and nope — still occurs in the latest versions of Monaco Editor on Safari ... not sure what could be causing it -_-

louis993546 commented 10 months ago

ok did some debugging and I feel like it might be a WebKit thing:

e.g. In here, I just pressed the f key after a

Screenshot 2023-11-10 at 16 29 43

and you can see that in the debugger for some reason, textArea.getValue() returns

fun something() {
        af }

instead of

fun something() {
        af
}

(textArea is just a wrapper on the HTML element <textarea>)

Which leads to 1 weird way to workaround it: just make sure you are typing on the last line in Safari, and then there is no more \n for WebKit to mix up 😂 .

https://github.com/romannurik/SlidesCodeHighlighter/assets/3873011/5d38bd8b-5479-4389-a736-e40da80cb058

romannurik commented 2 months ago

I just updated to the latest monaco-editor, would love if someone wants to see if this is still an issue :-/

louis993546 commented 2 months ago

@romannurik seems the same unfortunately

romannurik commented 2 months ago

Gahhh.. another option is to just switch to CodeMirror. I may try that at some point soon.

romannurik commented 2 months ago

Found the issue, it was with a quirk specific to SlidesCodeHighlighter and CSS styling.... lol. Fixed.