I have embedded Codemirror into a mobile project and it uses the Android webview to display. It works great. One, or two problems.

Since there will never be a resize event without me doing it, i want to stop the editor from listening for window resizes. This is why.

When I change the viewport size, codemirror catches it, then sets it back to the smaller size, i setSize(w,h) after my call so it ‘blinks’ looking very unprofessional.

Second, it attempts to fix the scroll on viewport change and that adjust isnt needed as I’m calling scrollIntoView.

So… can I stop this default behaviour?

How are you changing the viewport size? In principle, the resize event handler is already a no-op when the editor was already redrawn at its current size. It definitely does not change the editor’s size – it just checks whether the new window size ended up changing the editor’s box size, and if so, updates for that new size.

I was changing the viewport dynamically when the soft keyboard would be active. I figured it out. Thank you. However, found a new interesting thing I can’t seem to work out.

I have the viewport set to 10 (default). When scrolling (touch) it doesn’t update the next 10 lines until it is visible within the editor, so you see a blink, or you see a pause before the code is displayed. Can I somehow get it to start the updating BEFORE it is visible? Say 5 lines ‘out of view’ or half the viewport? I hope i’m explaining it good enough.

THANK YOU for all your help.

I just cant get the editor ‘blink’ when adding the next ‘x’ amount of lines to stop. Ideally, I’d like to set the viewPort at 50, then when it scrolls within 25 do an update, so it looks seamless.

Can this be done?

The code, as it is, already aims to prevent any blinking that happens during scrolling. If it isn’t working, that would be a bug, and I’d be interested in a precise description of what you are doing that triggers the problem. If you go to, for example, , and scroll there, can you reproduce the flickering? Which Android version are you using?

Yes, the flickering happens there in the default web browser (Android 4.1.2).

I am simply touch scrolling inside the editor. It seems to wait until there are no lines left to display before adding more to the viewport, creating a blink, or a pause.

I have continued trying to get this behavior to stop, but it remains ‘jumpy’ or ‘pauses’ when scrolling.

Any ideas?

Confirmed. I’ve opened for this.

I am hoping a solution may present itself soon.