From f62a43965b1875d48da7fb48dde70dc62fa2530a Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Wed, 28 Mar 2012 22:50:23 -0700 Subject: [PATCH] Fixed bug for selecting lines with non-integer heights. It put up a fight... --- static/js/CodeMirror/codemirror.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/static/js/CodeMirror/codemirror.js b/static/js/CodeMirror/codemirror.js index c840de05b7..b20a7d033b 100644 --- a/static/js/CodeMirror/codemirror.js +++ b/static/js/CodeMirror/codemirror.js @@ -1613,7 +1613,7 @@ var CodeMirror = (function() { var lineNo = lineAtHeight(doc, heightPos); if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length}; var lineObj = getLine(lineNo), text = lineObj.text; - var tw = options.lineWrapping, innerOff = tw ? heightPos - heightAtLine(doc, lineNo) : 0; + var tw = options.lineWrapping, innerOff = tw ? Math.floor(heightPos - heightAtLine(doc, lineNo)) : 0; if (x <= 0 && innerOff == 0) return {line: lineNo, ch: 0}; function getX(len) { var sp = measureLine(lineObj, len); @@ -2437,7 +2437,6 @@ var CodeMirror = (function() { }, nodeAdded: function(node) { if (this.widgetFunction) this.widgetFunction.callback(node, this); - //this.setHeight(node.clientHeight); }, // Fetch the parser token for a given character. Useful for hacks // that want to inspect the mode state (say, for completion).