GNOME Bugzilla – Bug 132821
SourceMarkers should be line based
Last modified: 2014-02-15 12:53:14 UTC
Right now, SourceMarkers are implemented with TextMarks as a backend. However this does not fit the model that most people use the `SourceMark' for. Since the mark displays an icon on the line which it is places, it is natural to limit 1 marker per type per line. Also, the functions should be reworked to accomodate this. For example, right now in MD we have: public void NextBookmark () { TextIter loc = GetIterAtMark (InsertMark); int ln = loc.Line; IntPtr nextMarker = gtk_source_buffer_get_next_marker (Handle, ref loc); IntPtr firstMarker = nextMarker; bool first = true; while (true) { // Thats a wrap! if (nextMarker == IntPtr.Zero) nextMarker = gtk_source_buffer_get_first_marker (Handle); IntPtr nm = gtk_source_marker_get_marker_type (nextMarker); string name = GLibSharp.Marshaller.PtrToStringGFree (nm); if (name == "SourceEditorBookmark") { gtk_source_buffer_get_iter_at_marker (Handle, ref loc, nextMarker); if (! first || loc.Line != ln) break; } nextMarker = gtk_source_marker_next (nextMarker); first = false; } PlaceCursor (loc); } Which will place the bookmark on the next line (yes, that is a wierd combo of bindings + function invokes, this is because of refcounting issues + gtype issues) Really this function should be built in, so that you can just `go to the next marker of this type'
Sorry for the very very late reply. It is not clear to me what you mean with line based. Limiting to 1 marker per type per line sounds wrong to me. Suppose the case where you have a bookmark + a breakpoint at the same line or multiple syntax errors at the same line. I agree we need a method to go to the next/prev marker of the same type. I think you can implement the above method in a saner way by checking if there are markers in the current line with gtk_source_buffer_get_markers_in_region.
We got new fancy API for marks now.