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

iOS IME causes app/page freeze with line wrapping. #502

Closed
lishid opened this issue Jun 1, 2021 · 4 comments
Closed

iOS IME causes app/page freeze with line wrapping. #502

lishid opened this issue Jun 1, 2021 · 4 comments

Comments

@lishid
Copy link

@lishid lishid commented Jun 1, 2021

After receiving many bug reports of the editor freezing while typing in Chinese and Japanese, despite having no debugging capabilities once the entire app (or safari page) freezes, I have found a weird combination on https://codemirror.net/6/ that can repro this bug!

Steps to repro:

  • Open https://codemirror.net/6/ on iOS (Tested with iPhone 7 and iPhone 11, iOS 14.5.2 and 14.6)
  • (See picture below) Use remote debugger from macOS safari to add the css white-space: pre-wrap to the content element .cm-content.
  • Zoom out to see the full width of the page. (For some reason this step seems to be required)
  • Use the Chinese IME to type "a", then space to confirm the conversion, repeat until the entire browser page freezes. Sometimes this takes 20-30 tries, or until the line wraps. Sometimes this happens a few characters in.
  • Notice that remote debugger is completely frozen and no commands work, including pausing script execution.
  • Video attached.

image

Extra information that might be helpful:

  • In my testing, disabling drawSelection seems to fix this issue, but it is required to use allowMultipleSelections. Disabling line wrapping also fixes it. It seems that this is a unique combination that's causing the issue.
  • In the video, once it's frozen, despite the cursor still blinking, I am trying to type many keys. Later, when the keyboard is closed, I am attempting to scroll the page.
  • When this issue happens, my device gets hot, suggesting that it may have ran into an infinite loop somewhere.
RPReplay_Final1622523711.mp4
@lishid
Copy link
Author

@lishid lishid commented Jun 1, 2021

@marijnh
Copy link
Member

@marijnh marijnh commented Jun 1, 2021

Well, that was fun to debug—Mobile Safari goes completely black-hole once it hits an infinite loop, not letting any information escape from its bowels. Fortunately I found a way to reliably trigger this issue, so I just kept moving early return statements around until I found out where the problem comes from. And it was a dumb bug in the library itself—see attached patch.

@lishid
Copy link
Author

@lishid lishid commented Jun 1, 2021

Thank you!

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

Successfully merging a pull request may close this issue.

None yet
2 participants