public void Split(Gtk.TextIter iter, Gtk.TextBuffer buffer) { foreach (Gtk.TextTag tag in iter.Tags) { NoteTag noteTag = tag as NoteTag; if (noteTag != null && !noteTag.CanSplit) { Gtk.TextIter start = iter; Gtk.TextIter end = iter; // We only care about enclosing tags if (start.TogglesTag(tag) || end.TogglesTag(tag)) { continue; } start.BackwardToTagToggle(tag); end.ForwardToTagToggle(tag); AddSplitTag(start, end, tag); buffer.RemoveTag(tag, start, end); } } }