exo icon indicating copy to clipboard operation
exo copied to clipboard

[BUG] Monaco editor text selection squishes whitespace

Open jrysana opened this issue 3 years ago • 8 comments

Describe the bug Monaco editor text selection squishes whitespace in a very unexpected and annoying way. For some reason this feels infuriating, and I haven't yet been able to figure out why it happens. It causes the text to "jump" around when you select it.

To Reproduce Steps to reproduce the behavior:

  1. Go to a page with a Monaco editor, e.g. "New Process"
  2. Type a script that has indented lines (in my case 4 spaces indent)
  3. Select the text

Expected behavior The whitespace in the editor should not change when text is selected

Screenshots image image

System Info

  • OS: Windows/WSL/Chrome

jrysana avatar Sep 01 '21 00:09 jrysana

Do we know if maybe one of our global or inherited stylesheet rules is causing the issue?

brandonbloom avatar Sep 01 '21 01:09 brandonbloom

No clue, but somehow I can no longer reproduce this - it seems fixed, but I didn't change anything.

jrysana avatar Sep 01 '21 14:09 jrysana

OK, then let's close this until it comes up again.

brandonbloom avatar Sep 01 '21 14:09 brandonbloom

Even when I was able to produce this bug, I was unable to identify any reason for the issue beyond the final visual result, despite digging through the DOM and stylesheets.

jrysana avatar Sep 01 '21 14:09 jrysana

Okay, it is not fixed. Just happened again.

Notably this has only been seen in the dev version so far. When I started up the dev version, it was working fine, at some point after making modifications to the page component the text editor was a child of, the bug came back. The bug persisted across all Monaco editors until I closed that browser window and opened a new one, after which it was fixed again.

jrysana avatar Sep 01 '21 15:09 jrysana

Same thing just happened, this time all I had changed was some inline CSS in the svelte <style> block of the parent component.

My current theory is that this bug is at some point triggered by the hot reloading of the app during development.

jrysana avatar Sep 01 '21 15:09 jrysana

Is this still happening? And is it still a dev-time only issue?

If it is dev only, is it annoying? If so, we can try to fix it together. Otherwise, we can probably ignore this.

brandonbloom avatar Oct 06 '21 22:10 brandonbloom

@brandonbloom yes - it is still happening, and yes so far only in dev. It's kinda annoying but not really because I barely need to use the Monaco editor for more than a few seconds in dev. Wouldn't allocate any time to fixing this until it shows up in prod (for now)

jrysana avatar Oct 07 '21 15:10 jrysana