Fix bug in Document.. If there are no lines after trimming off the spaces/tabs from the end return directly.

This commit is contained in:
Julian Viereck 2011-01-11 09:20:57 +01:00
commit b59155af7d

View file

@ -879,6 +879,12 @@ var Document = function(text, mode) {
}
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"