Cursor problem

Opera 48.0, CodeMirror 5.30
Just recently I’ve been having cursor trouble. The cursor wouldn’t appear inside text and sometimes I couldn’t even get it to appear at the end of a line. From marijn’s suggestion at Codemirror cursor is not (partially) visible I tried resizing the page horizontally and sometimes got the cursor to show.

I initiate CodeMirror with this:

editor = new CodeMirror.fromTextArea($element[0], options);
var $container = $(editor.getContainerElement());
$container.attr("templatetitle", $element.attr("templatetitle") || templateTitle);
$container.css({"margin-left": containerMargin,"margin-right": containerMargin});
$container.appendTo($container.parents("dd"));
//console.info(editor.getWrapperElement().getBoundingClientRect().width)
//console.info(editor.getContainerElement().getBoundingClientRect().width)
editor.refresh();
$(window).on("resize", function() {
	editor.setSize(null, expanded ? ($(window).innerHeight() - delta2) : null);
	editor.refresh();
});
CodeMirrorEditor[editor.id] = editor;
return editor;

Now here’s where it gets strange: when I checked some widths with getBoundingClientRect().width, the problem went away. So to test it I called that in the code for the toolbars I have for CodeMirror and it seems to solve the problem. Well, maybe it’s just a fluke, I don’t want to test it a thousand times . Could there be a bug in Opera (and elsewhere) with gBCR() that’s messing things up?

Stranger still is this: in early September I got tired of several areas on my site where if you scroll an internal scrollable element and hit the bottom or top it would then scroll the whole page so in several places I used code such as what follows to fix it

$("#taigachat_box").live("wheel", function(e) {
	var maxScroll = $(this).find("ol").outerHeight() - $(this).outerHeight() + 12;
	//console.info(maxScroll +" " + $(this).scrollTop())
	var delta = e.originalEvent.wheelDelta;
	var scroll = $(this).scrollTop();
	if((Math.abs(scroll - maxScroll) < 2 && delta < 0) || (scroll == 0 && delta > 0)) {
		return false;
	}
});

The original code simply tested scroll == maxScroll and everything worked fine. Now all my similar code is broken and I have to check it as you see in the present code. Note the console info line – I used that to check my value of maxScroll back when I developed the code and it returned integer values so I went ahead with a simple comparison in the conditional. Now I get numbers with decimals. Something in the web has really changed and it’s going to break a lot of code.

Well, I think all I have to do for a proper fix is set CodeMirror’s width to an integer value but maybe the next version should do that internally. I’m just wondering if anyone else is having cursor trouble