diff --git a/lib/ace/edit_session.js b/lib/ace/edit_session.js index 260baa5e..874ac938 100644 --- a/lib/ace/edit_session.js +++ b/lib/ace/edit_session.js @@ -2187,7 +2187,7 @@ var EditSession = function(text, mode) { while (row <= screenRow) { rowLength = this.getRowLength(docRow); - if (row + rowLength - 1 >= screenRow || docRow >= maxRow) { + if (row + rowLength > screenRow || docRow >= maxRow) { break; } else { row += rowLength; @@ -2222,9 +2222,10 @@ var EditSession = function(text, mode) { if (this.$useWrapMode) { var splits = this.$wrapData[docRow]; if (splits) { - column = splits[screenRow - row]; - if(screenRow > row && splits.length) { - docColumn = splits[screenRow - row - 1] || splits[splits.length - 1]; + var splitIndex = Math.floor(screenRow - row); + column = splits[splitIndex]; + if(splitIndex > 0 && splits.length) { + docColumn = splits[splitIndex - 1] || splits[splits.length - 1]; line = line.substring(docColumn); } } diff --git a/lib/ace/edit_session/folding.js b/lib/ace/edit_session/folding.js index a9b2ddd1..b5bc36bd 100644 --- a/lib/ace/edit_session/folding.js +++ b/lib/ace/edit_session/folding.js @@ -627,6 +627,8 @@ function Folding() { if (depth == undefined) depth = 100000; // JSON.stringify doesn't hanle Infinity var foldWidgets = this.foldWidgets; + if (!foldWidgets) + return; // mode doesn't support folding endRow = endRow || this.getLength(); startRow = startRow || 0; for (var row = startRow; row < endRow; row++) {