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

Displayed portion of text field moves around (at least while editing CodeMirror 6 fields) #271

Closed
cpeikert opened this issue Mar 16, 2023 · 5 comments

Comments

@cpeikert
Copy link

Setup

Browser: Chrome 111.0.5563.64 (macOS 13.2.1)
Editor: Emacs mac port

Description

While editing on Overleaf (using the new support for CodeMirror 6; see #238): as I edit text in my emacs window, the displayed document text in the browser window "jumps downward," to points far away from the material being edited.

Specifically, with each keystroke in the editor (insert/delete character), the displayed portion of the document seems to move down by about 10%, until it reaches the end and stays there. If I move back up, each keystroke moves the window back down.

@fregante
Copy link
Owner

Could you verify the behavior from eMacs towards any other fields here? https://ghosttext.fregante.com/test/

The problem could be two-sided:

  • the server doesn't send the cursors
  • the browser doesn't set the cursors

@cpeikert
Copy link
Author

cpeikert commented Mar 16, 2023

I edited these fields using my setup, but was not able to induce the buggy behavior, probably for the following reason.

The CodeMirror 6 field(s) grow and shrink as lines of text are added and removed in the editor, so that all the text is always visible in the field (no scroll bar). So, the field does not "jump downward" -- it cannot move at all.

By contrast, the CodeMirror 5 fields do not grow and shrink (a scroll bar appears when the text grows too big to fit the field). When editing text within the field's view, the text remains in place and the edits are visible. When editing text that is out of view, the field automatically scrolls to make the edits visible (as desired).

@fregante
Copy link
Owner

fregante commented Mar 16, 2023

CodeMirror 5 also can grow and shrink: https://codemirror.net/5/

The behavior you're seeing on the test page specifically is due to my own lazy implementation 😅

It seems however that I had misunderstood your initial bug report, so I'll have to try it out myself later this week or next week.

@fregante
Copy link
Owner

Can you post a screencast? I don't understand what the issue is. Even on the official CM6 field the scroll position never changes: https://codemirror.net

cm6.mov

Same for CM5: https://codemirror.net/5/

cm5.mov

Also please ensure that the bug does not happen with Sublime Text or VS Code

@fregante
Copy link
Owner

fregante commented Mar 17, 2023

I can reproduce the issue in Overleaf when typing in the middle of the document. Unfortunately I think this is a custom Overleaf behavior because it only happens at some point/section in the document, suggesting that there's some custom logic behind it.

Screen.Recording.1.mov

Given that there's no particular reason to look at the field in the browser while you're editing it in your editor, I'm going to close this.

There's a chance that this behavior will be fixed as part of:

@fregante fregante closed this as not planned Won't fix, can't repro, duplicate, stale Mar 17, 2023
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