Merge pull request #52 from slap-editor/last-character-crop-fix
Fixes last character cropping bug
This commit is contained in:
commit
e8571684a7
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue