diff --git a/src/editor/Editor.js b/src/editor/Editor.js index 78f5aa267f3..85c77e76fe1 100644 --- a/src/editor/Editor.js +++ b/src/editor/Editor.js @@ -884,13 +884,18 @@ define(function (require, exports, module) { */ Editor.prototype.getColOffset = function (pos) { var line = this._codeMirror.getRange({line: pos.line, ch: 0}, pos), - tabSize = Editor.getTabSize(), + tabSize = null, column = 0, i; for (i = 0; i < line.length; i++) { if (line[i] === '\t') { - column += (tabSize - (column % tabSize)); + if (tabSize === null) { + tabSize = Editor.getTabSize(); + } + if (tabSize > 0) { + column += (tabSize - (column % tabSize)); + } } else { column++; }