def remove_breakpoint_line_mark(cls, b: GtkSource.Buffer,
                                 ssb_filename: str, opcode_offset: int,
                                 category: str):
     # XXX: This is a bit ugly, but due to the fact, that there can be one call to a macro
     # in the same file, there can be exactly 0-2 line markers:
     for i in [0, 1]:
         m: Gtk.TextMark = b.get_mark(
             f'for:opcode_<<<{ssb_filename}>>>_{opcode_offset}_{i}')
         if m is None:
             return
         b.remove_source_marks(b.get_iter_at_mark(m), b.get_iter_at_mark(m),
                               category)
 def add_line_mark_for_op(cls, b: GtkSource.Buffer, ssb_filename: str,
                          opcode_addr: int, name: str, category: str,
                          is_for_macro_call: bool):
     m = cls._get_opcode_mark(b, ssb_filename, opcode_addr,
                              is_for_macro_call)
     if m is not None:
         b.create_source_mark(name, category, b.get_iter_at_mark(m))
 def scroll_to_op(cls, b: GtkSource.Buffer, view: GtkSource.View,
                  ssb_filename: str, opcode_addr: int,
                  is_for_macro_call: bool):
     m = cls._get_opcode_mark(b, ssb_filename, opcode_addr,
                              is_for_macro_call)
     if m is not None:
         view.scroll_to_mark(m, 0.1, False, 0.1, 0.1)
         b.place_cursor(b.get_iter_at_mark(m))
 def add_breakpoint_line_mark(cls, b: GtkSource.Buffer, ssb_filename: str,
                              opcode_offset: int, category: str):
     ms = []
     m: Gtk.TextMark = cls._get_opcode_mark(b, ssb_filename, opcode_offset,
                                            True)
     if m is not None:
         ms.append(m)
     m = cls._get_opcode_mark(b, ssb_filename, opcode_offset, False)
     if m is not None:
         ms.append(m)
     for i, m in enumerate(ms):
         line_iter = b.get_iter_at_line(b.get_iter_at_mark(m).get_line())
         lm: Gtk.TextMark = b.get_mark(
             f'for:opcode_<<<{ssb_filename}>>>_{opcode_offset}_{i}')
         if lm is not None:
             return
         b.create_source_mark(
             f'for:opcode_<<<{ssb_filename}>>>_{opcode_offset}_{i}',
             category, line_iter)