Improve test on start/end in _on_delete_text for issue385

This commit is contained in:
Cédric Krier committed 2008-09-19 17:50:13 +02:00
1 parent a9081cc409
commit c4a5b47586
1 file changed
+9 -1
+9 -1
View File
@@ -105,7 +105,15 @@ class DateEntry(gtk.Entry):
if not self._interactive_input:
return
while (start>0) and (self.initial_value[start] not in [' ','0','X']):
if start > len(self.initial_value):
start = len(self.initial_value)
if start < 0:
start = 0
if end > len(self.initial_value):
end = len(self.initial_value)
if end < 0:
end = 0
while (start > 0) and (self.initial_value[start] not in [' ','0','X']):
start -= 1
text = self.get_text()
text = text[:start] + self.initial_value[start:end] + text[end:]