Permalink
Browse files

Merge pull request #75 from alltom/alltom/measureLine-fix

fix exception when adding inline widgets to blank lines
  • Loading branch information...
2 parents 237b08c + be0e0bc commit 156c5f08c4f21f8c73809c0edbf7043ce978516f @njx njx committed Aug 24, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/codemirror.js
View
@@ -1179,7 +1179,7 @@ var CodeMirror = (function() {
else {
// Position the widget below the bottom of the entire (wordwrapped) line.
var lineNum = inline.getLineNumber();
- var pos = {line: lineNum, ch: inline.getLine().text.length - 1};
+ var pos = {line: lineNum, ch: Math.max(inline.getLine().text.length - 1, 0)};
inline.node.style.top = (paddingTop() + localCoords(pos, true).yBot) + "px";
if (lineNum >= from && lineNum < to) {
numVisibleInlines++;

0 comments on commit 156c5f0

Please sign in to comment.