I'm trying to insert text before and after selection in textbuffer. All works fine but after applying tag program crash with error:
here is part of my code I use:
self.tag_bold = self.des_buffer.create_tag("bold", weight=Pango.Weight.BOLD)
self.tag_hide = self.des_buffer.create_tag("hide", invisible=True)
def text_edit(self, widget, html_format_start):
bounds = self.des_buffer.get_selection_bounds()
start, end = bounds
self.des_buffer.insert_with_tags_by_name(start, html_format_start, 'hide')
def on_button_text_bold_clicked(self, widget):
self.test1 = "<B>"
self.test2 = "</B>"
self.text_edit(self, self.tag_hide)
self.text_edit(self, self.test1)
self.text_edit(self, self.test2)
Error message:
(magic-ebay:6056): Gtk-WARNING **: /build/buildd/gtk+3.0-3.4.2/./gtk/gtktextbtree.c:4019: byte index off the end of the line
(magic-ebay:6056): Gtk-ERROR **: Byte index 24 is off the end of the line
when I only use different tag then hide (invisible) all works fine, no crash occur. Any idea ?