Call emitLine() only once

emitLine() was called twice in some cases
This commit is contained in:
alafr 2016-11-06 02:28:01 +02:00 committed by GitHub
parent a944efdac5
commit e02f69ac00

View File

@ -155,6 +155,11 @@ class LineWrapper extends EventEmitter
buffer = buffer + @ellipsis
if bk.required and w > @spaceLeft
buffer = word;
textWidth = w;
wc = 1;
emitLine()
# if we've reached the edge of the page,
@ -170,13 +175,6 @@ class LineWrapper extends EventEmitter
# reset the space left and buffer
if bk.required
# if there's a word but no space left, emit single line
if w > @spaceLeft
buffer = word
textWidth = w
wc = 1
emitLine()
@spaceLeft = @lineWidth
buffer = ''
textWidth = 0