From a6f6f4df8afe3be28eaef589ac17b84566aed1ea Mon Sep 17 00:00:00 2001 From: Devon Govett Date: Mon, 14 Apr 2014 09:58:26 -0700 Subject: [PATCH] Don't use trimRight since it isn't supported in IE --- lib/line_wrapper.coffee | 4 ++-- lib/mixins/text.coffee | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/line_wrapper.coffee b/lib/line_wrapper.coffee index ec11e08..caa2e3c 100644 --- a/lib/line_wrapper.coffee +++ b/lib/line_wrapper.coffee @@ -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 diff --git a/lib/mixins/text.coffee b/lib/mixins/text.coffee index a558d99..e27b5eb 100644 --- a/lib/mixins/text.coffee +++ b/lib/mixins/text.coffee @@ -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'