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)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier committed 2022-04-16 11:27:21 +02:00
1 parent a90ad79da1
commit fd42736293
1 file changed
+2 -1
+2 -1
View File
@@ -36,7 +36,8 @@ class CellRendererFloat(CellRendererInteger):
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