Skip to content

Commit

Permalink
Merge pull request foliojs#764 from alafr/undo-bug
Browse files Browse the repository at this point in the history
Fix linewrapper bug
  • Loading branch information
alafr authored Feb 2, 2018
2 parents cbd016a + 151200d commit d1cb526
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/line_wrapper.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@ class LineWrapper extends EventEmitter
wc++

if bk.required or w > @spaceLeft
if bk.required
@emit 'lastLine', options, this

# if the user specified a max height and an ellipsis, and is about to pass the
# max height and max columns after the next line, append the ellipsis
lh = @document.currentLineHeight(true)
Expand All @@ -155,10 +152,14 @@ class LineWrapper extends EventEmitter

buffer = buffer + @ellipsis

if bk.required and w > @spaceLeft
buffer = word
textWidth = w
wc = 1
if bk.required
if w > @spaceLeft
emitLine()
buffer = word
textWidth = w
wc = 1

@emit 'lastLine', options, this

emitLine()

Expand Down

0 comments on commit d1cb526

Please sign in to comment.