-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
[mobile] Colouring not picking changes until non-word characters #3655
Comments
Mobile platforms tend to input words using composition events. Highlighting tends to involve redrawing, and redrawing during a composition will reset that composition, which would be bad, so CodeMirror has to leave the input field alone until the composition ends (in this case, when the space was typed). As such, I don't think this is something we can really help. |
Reasonable, thank you! Might be worth mentioning in the manual, also clarifying if CodeMirror merely backs off highlighting during composition, or if it doesn't fire 'change' events either. |
It currently does not fire change events, but possibly will in the future (I'm planning to overhaul composition handling when I find time), so I don't want to set down any specific behavior yet. |
Reasonable too. A bigger problem is completions/hints (which some IDEs pop up intelligently listening to the 'changes'). Typing this Perhaps for code composition is harmful anyway. Typing Can you please add a switch to ignore composition concerns, making mobile more aligned with desktop? Naturally off by default, but for code editors it would be brilliant! Again, thanks for giving it a thought. |
Nope. Or at least, I don't know how to disable this behavior in mobile browsers. If you do, let me know. (Autocompletion is indeed the main reason I'm considering applying composition changes immediately, so that a meaningful completion list could be shown.) |
What I meant is that with that option enabled, don't do this:
Polling seems to work, if other events are being suspended by browser during composition, I checked with JSBin |
I don't think that will do what we'd want it to do — it'd become impossible for, for example, Chinese users to type into the editor. |
Yes, and in case of ode editor/IDE that is a desirable tradeoff. Perhaps I should experiment with implementing that and come with results before going any further. Thanks a lot! |
Using JavaScript demo go in the method and type 'this'.
The text is using basic black colour and 'this' word is underlined.
Now type '.'.
The word 'this' is no longer underlined, and it's dark-purple (correct keyword colour).
This happens in:
It also is dependent on the order of the edits. For example, deleting characters with backspace never causes this quirk.
Also note that when this happens in the middle of the line, the characters on the right of the line do get pushed right. Which means this typing experience is not completely virtual, it does change the DOM state somehow. But it looks like CM fails to notice the change.
Also see related:
#3653 Arrow keys hide keyboard - Chrome mobile 46
#3654 Newline/editing bugs in Android Browser
The text was updated successfully, but these errors were encountered: