diff --git a/lib/ace/document.js b/lib/ace/document.js index 40a4ed38..b4b1d674 100644 --- a/lib/ace/document.js +++ b/lib/ace/document.js @@ -862,10 +862,12 @@ var Document = function(text, mode) { }; this.$computeWrapSplits = function(textLine, wrapLimit, tabSize) { + textLine = textLine.trimRight(); if (textLine.length == 0) { return []; } + var reSpaces = /^\s*$/; var tabLine = textLine.split("\t"); var wrapSplits = []; @@ -873,29 +875,6 @@ var Document = function(text, mode) { var documentColumn = 0; var lastSplitColumn = 0; - var reSpaces = /^\s*$/; - - // Remove all tablines from the end of the tabLine array that are empty - // or contain only space. This is necessary to prevent splits at the - // line end if only tabs/spaces are following. - // E.g: "foo bar\t " -> "foo bar". - var toRemove = tabLine.length - 1; - while (toRemove != -1 && reSpaces.test(tabLine[toRemove])) { - toRemove --; - } - tabLine.splice(toRemove + 1); - - // Shortcut: If there are no more tabLines, then there is nothing to - // split up. - if (tabLine.length == 0) { - return []; - } - - // Remove spaces from the last tabLine to prevent splits only for - // whitespaces as well. - // E.g: "foo \tbar " -> "foo \tbar" - tabLine[tabLine.length - 1] = tabLine[tabLine.length - 1].trimRight(); - var value; var addedNewSplit;