From 6f73960c40bbb83535cf65e018215d9118151714 Mon Sep 17 00:00:00 2001 From: picobyte Date: Tue, 14 Nov 2017 23:50:32 +0100 Subject: [PATCH] fix single insertion on 2nd+ line Signed-off-by: picobyte --- game/edit_button.rpy | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/game/edit_button.rpy b/game/edit_button.rpy index a435982..c0d25b2 100644 --- a/game/edit_button.rpy +++ b/game/edit_button.rpy @@ -352,18 +352,19 @@ init -1500 python in _editor: # Move cursor to end of insertion. This is tricky. i = 0 cx += len(entries[-1]) - while cy + 1 != self.nolines: - bx, by = self.wrap2buf[cy+1] - if i == len(entries) - 1 and (bx == 0 or bx >= len(entries[i])): - if i == 0: - cx -= self.wrap2buf[cy][0] - elif cx == 0: - cx = len(entries[i]) - self.wrap2buf[cy][0] - break - cy += 1 - if self.wrap2buf[cy][0] == 0: - i += 1 - cx = 0 + if len (entries) > 1: + while cy + 1 != self.nolines: + bx, by = self.wrap2buf[cy+1] + if i == len(entries) - 1 and (bx == 0 or bx >= len(entries[i])): + if i == 0: + cx -= self.wrap2buf[cy][0] + elif cx == 0: + cx = len(entries[i]) - self.wrap2buf[cy][0] + break + cy += 1 + if self.wrap2buf[cy][0] == 0: + i += 1 + cx = 0 self.console.cy = self.console.CY = cy self.console.max = self.console.cx = self.console.CX = cx renpy.redraw(self.console, 0)