Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very long line editor glitch #1448

Closed
FFFFFFFXXXXXXX opened this issue Sep 26, 2024 · 5 comments
Closed

Very long line editor glitch #1448

FFFFFFFXXXXXXX opened this issue Sep 26, 2024 · 5 comments

Comments

@FFFFFFFXXXXXXX
Copy link

Describe the issue

If I set the content of the editor to a single line containing more than 1_245_526 characters in firefox or more than 1_877_171 characters in chrome the cursor disappears.

Additionally in firefox with enough characters the cursor gets placed in a different position in the text than was clicked.

Reproduce:

  1. Go to https://codemirror.net/try/?example=Minimal%20editor
  2. paste the text from firefox.txt or chrome.txt depending on browser
  3. add a single character => on firefox the whole line is suddenly blank and in chrome the cursor is invisible

Additionally:

  1. Go to https://codemirror.net/try/?example=Minimal%20editor on firefox
  2. paste the text from chrome.txt
  3. go to the start of the line and click somewhere in the line => the cursor doesn't get placed where you clicked

Tested on:

  • Firefox 130.0.1 (64-Bit) for Windows
  • Google Chrome Version 129.0.6668.70 (official build) (64-Bit) for Windows

Browser and platform

No response

Reproduction link

No response

@marijnh
Copy link
Member

marijnh commented Sep 27, 2024

What is happening here is that the browser's CSS engine, which internally uses fixed-precision numbers, starts falling apart at this scale. CodeMirror has some (gnarly) scaling logic to make documents higher than this limit work, but it doesn't currently have any such strategy for lines wider than the limit.

@FFFFFFFXXXXXXX
Copy link
Author

Thanks for the quick answer.
Since this is more of a browser limitation should I close this issue?

@marijnh
Copy link
Member

marijnh commented Sep 27, 2024

Attached patch adds a kludge to try and keep the actual pixel size of such lines small enough for the browser to be able to lay them out.

marijnh added a commit to codemirror/view that referenced this issue Sep 27, 2024
FIX: Improve the way enormously long (non-wrapped) lines are displayed by making sure they
stay shorter than the maximal pixel size the browser's CSS engine can handle.

Closes codemirror/dev#1448
@marijnh
Copy link
Member

marijnh commented Sep 27, 2024

Err, ignore that first patch link. That was just me committing in the wrong directory. The second one is the actual patch.

@FFFFFFFXXXXXXX
Copy link
Author

I just noticed there was already a release that includes the patch - works perfectly.
Just wanted to let you know I really appreciate your work and the quick response :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants