From 3b5524429689c20c33048d7ced29f7476a7eed8b Mon Sep 17 00:00:00 2001 From: KaboPC Date: Sun, 9 Dec 2012 13:14:58 -0500 Subject: [PATCH] Fix index out-of-range in pos_to_index Fix a crash occurring from trying to access a list with a negative index when drag-selecting text above the field box boundaries.(cherry picked from commit 609538b441a0dcf7890b4656c98673ee8de8820d) --- albow/fields.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/albow/fields.py b/albow/fields.py index 348ffb3..00b4062 100644 --- a/albow/fields.py +++ b/albow/fields.py @@ -893,6 +893,9 @@ class TextEditorWrapped(Widget): if line >= len(textL): line = len(textL) - 1 + + if line < 0: + line = 0 def width(i): return font.size(textL[line][:i])[0]