Merge pull request #52 from slap-editor/last-character-crop-fix

Fixes last character cropping bug
This commit is contained in:
Christopher Jeffrey 2014-06-05 12:54:27 -05:00
commit e8571684a7
1 changed files with 3 additions and 4 deletions

View File

@ -2229,6 +2229,7 @@ main:
if (++total === width) {
// If we're not wrapping the text, we have to finish up the rest of
// the control sequences before cutting off the line.
i++;
if (!wrap) {
rest = line.substring(i).match(/\x1b\[[^m]*m/g);
rest = rest ? rest.join('') : '';
@ -2238,12 +2239,10 @@ main:
continue main;
}
// Try to find a space to break on.
if (line[i] !== ' ') {
if (i !== line.length) {
j = i;
while (j > i - 10 && j > 0 && line[j] !== ' ') j--;
while (j > i - 10 && j > 0 && line[--j] !== ' ');
if (line[j] === ' ') i = j + 1;
} else {
i++;
}
break;
}