From 5c607eb3a81f4cb497009cb7199124691cd05e3b Mon Sep 17 00:00:00 2001 From: Mirko Galimberti Date: Fri, 13 Sep 2019 15:50:58 +0200 Subject: [PATCH] Fixes positioning (valign) issue when using max_lines Better fix. Also handles different heights. use dwn to check what lines need to be removed --- kivy/core/text/text_layout.pyx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kivy/core/text/text_layout.pyx b/kivy/core/text/text_layout.pyx index f21d57369..dbdab31df 100644 --- a/kivy/core/text/text_layout.pyx +++ b/kivy/core/text/text_layout.pyx @@ -566,8 +566,10 @@ def layout_text(object text, list lines, tuple size, tuple text_size, if max_lines > 0 and len(lines) > max_lines: val = True if dwn: + h-= sum(l.h for l in lines[max_lines:]) del lines[max_lines:] else: + h-= sum(l.h for l in lines[:max(0, len(lines) - max_lines)]) del lines[:max(0, len(lines) - max_lines)] # now make sure we don't have lines outside specified height