Don't use trimRight since it isn't supported in IE

This commit is contained in:
Devon Govett 2014-04-14 09:58:26 -07:00
parent 39ac0a69fe
commit a6f6f4df8a
2 changed files with 3 additions and 3 deletions

View File

@ -141,12 +141,12 @@ class LineWrapper extends EventEmitter
lh = @document.currentLineHeight(true)
if @height? and @ellipsis and @document.y + lh * 2 > @maxY and @column >= @columns
@ellipsis = '' if @ellipsis is true # map default ellipsis character
buffer = buffer.trimRight()
buffer = buffer.replace(/\s+$/, '')
textWidth = @wordWidth buffer + @ellipsis
# remove characters from the buffer until the ellipsis fits
while textWidth > @lineWidth
buffer = buffer.slice(0, -1).trimRight()
buffer = buffer.slice(0, -1).replace(/\s+$/, '')
textWidth = @wordWidth buffer + @ellipsis
buffer = buffer + @ellipsis

View File

@ -182,7 +182,7 @@ module.exports =
if options.width
switch align
when 'right'
textWidth = @widthOfString text.trimRight(), options
textWidth = @widthOfString text.replace(/\s+$/, ''), options
x += options.lineWidth - textWidth
when 'center'