From c40dddb06c646b9d8563a13c7185bb4e3f138887 Mon Sep 17 00:00:00 2001 From: picobyte Date: Wed, 15 Nov 2017 00:12:52 +0100 Subject: [PATCH] Using RenPy's internal textwrap seems to work better here. Signed-off-by: picobyte --- game/edit_button.rpy | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/game/edit_button.rpy b/game/edit_button.rpy index c0d25b2..fe34f8d 100644 --- a/game/edit_button.rpy +++ b/game/edit_button.rpy @@ -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)