Skip to content

Commit

Permalink
Using RenPy's internal textwrap seems to work better here.
Browse files Browse the repository at this point in the history
Signed-off-by: picobyte <[email protected]>
  • Loading branch information
picobyte authored and picobyte committed Nov 14, 2017
1 parent 6f73960 commit c40dddb
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions game/edit_button.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -147,19 +147,15 @@ init -1500 python in _editor:
self.nolines = 0
tot = 0
for line in self.data[self.lnr:min(self.lnr + self._maxlines, len(self.data))]:
wrap = textwrap.wrap(line, self.lineLenMax)
if len(wrap) == 0:
wrap = textwrap.wrap(line, self.lineLenMax, drop_whitespace=False) or ['']
wrap = renpy.text.extras.textwrap(line, self.lineLenMax) or ['']
offs = 0
for l in wrap:
offs += line.index(l, offs) - offs
self.wrap2buf[tot]=(offs, self.nolines)
tot += 1
if tot > self._maxlines:
return
offs += len(l)
if offs == 0 or l[-1] != '-': # is there more? e.g. long words?
offs += 1
offs -= 1
self.nolines += 1
self.wrapped_buffer.extend(wrap)

Expand Down

0 comments on commit c40dddb

Please sign in to comment.