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)
This commit is contained in:
KaboPC 2012-12-09 13:14:58 -05:00 committed by David Vierra
parent b0b8813022
commit 3b55244296

View File

@ -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]