No linewrap, gutter width problem


#1

I programmatically add/remove three gutters (code folding, bookmark, and line numbers) depending on users settings. This is done after initialization of codemirror.

This is within mobile webview.

Even after calling cm.refresh() the cursor will disappear to the right of the screen the same width of my gutters. If no gutter is on, all works perfectly. Using arrow key right scrolls as you get near the right border.

Is there another way to force the gutter calculation into this right scroll margin? or is this a bug? CM 5.24


#2

Changing the set of gutters should recompute the gutter width, so you shouldn’t even need a refresh call. Can you reproduce the issue on a desktop browser?


#3

The instance of codemirror is wrapped up in a mobile webview.

If the problem is the mobile aspect, can you direct me to where this is handled? Or at the minimum where it checks the bounds?


#4

I know. Does the same problem occur when it’s not?


#5

Due to the handling, it would be next to impossible to recreate the instance in a normal browser, it is intertwined with the android Java backend and I control the webview through a JavaScript to Java bridge.

I have tracked the function getDimensions(cm) and it properly has all my gutters with the correct widths. wrapper width is correct (full screen). So the problem is not with detecting the sizes, but when a goCharRight happens (right arrow).

As I said, without the gutters it starts to scroll maybe 10px before the cursor goes offscreen (right). With the gutters it isn’t adding their widths. It is detecting them by the getDimensions(cm) function.

Can you direct me? It seems if it is detecting the gutters properly, this is actually a bug?


#6

You don’t need to recreate the whole software, just the API calls to CodeMirror that cause the problem. If you want me to even think about this, you’re going to have to isolate the circumstances that produce the issue yourself.


#7

Will create a standalone instance. I’ll let you know the results as soon as possible.