changeset 0712649a1b67 in tryton:6.2
details: https://hg.tryton.org/tryton?cmd=changeset&node=0712649a1b67
description:
        Do not delete text if there is no end position

        When inserting text without selection, there is no text to delete.

        issue11138
        review371051002
        (grafted from 0c84c8539ede9f66ca4976ca1c19d72d9a196e94)
diffstat:

 tryton/common/cellrendererfloat.py |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (13 lines):

diff -r 7801173265b1 -r 0712649a1b67 tryton/common/cellrendererfloat.py
--- a/tryton/common/cellrendererfloat.py        Fri Apr 15 21:21:39 2022 +0200
+++ b/tryton/common/cellrendererfloat.py        Sat Apr 16 11:27:21 2022 +0200
@@ -36,7 +36,8 @@
                     end_pos = None
                 if self._can_insert_text(widget, text, start_pos, end_pos):
                     buffer_ = widget.get_buffer()
-                    buffer_.delete_text(start_pos, end_pos - start_pos)
+                    if end_pos:
+                        buffer_.delete_text(start_pos, end_pos - start_pos)
                     buffer_.insert_text(start_pos, text, len(text))
                     widget.set_position(widget.get_position() + len(text))
                 return True

Reply via email to