Skip to content

Commit

Permalink
Merge pull request #427 from hwshim/master
Browse files Browse the repository at this point in the history
[TASK] TextEditorPart : function definition for Strict Mode
  • Loading branch information
hwshim committed Sep 11, 2015
2 parents 5126788 + a27b494 commit d33b576
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -362,15 +362,14 @@ define([
}

if (viewer.retabIndentations) {
function getSpaces(n) {
var getSpaces = function(n) {
var spaces = ['', ' ', ' ', ' ', ' '];
if (spaces[n] === undefined) {
return (spaces[n] = ( n ? ' ' + getSpaces(n - 1) : ''));
} else {
return spaces[n];
}
}

};
var unit = viewer.options.indentUnit, re = /^(( )*)\t/m, m;
while (( m = text.match(re))) {
text = text.replace(re, '$1' + getSpaces(unit - (m[0].length - 1) % unit));
Expand Down

0 comments on commit d33b576

Please sign in to comment.