uix:TextInput fix for IndexError on empty new line

This commit is contained in:
qua-non 2013-08-10 02:27:11 +05:30
parent 4dd062416a
commit 340f42cef1
1 changed files with 7 additions and 1 deletions

View File

@ -2040,8 +2040,14 @@ class TextInput(Widget):
def _get_text(self, encode=True):
lf = self._lines_flags
l = self._lines
len_l = len(l)
if len(lf) < len_l:
lf.append(1)
text = u''.join([(u'\n' if (lf[i] & FL_IS_NEWLINE) else u'') + l[i]
for i in range(len(l))])
for i in range(len_l)])
if PY2 and encode and type(text) is not str:
text = text.encode('utf-8')
return text