[gedit-list] GtkSourceView, highlight lines with errors



Some days ago I started writing a simple editor for Nim language, using
Nims advanced idetools/nimsuggest service for error locating and source
completion.

I found no way to highlight lines with errors in a clean way. test-
widget.c example uses this code

gdk_rgba_parse (&color, "lightgreen");
gtk_source_mark_attributes_set_background (attrs, &color);

That works fine, but using a fixed color makes not too much sense for
applications using arbitrary color schemes with syntax highlight. What
would one do to highlight background, when color schemes are used? No
idea still after some hour of googling and testing. What we would need
is a way to ask current background color, so that we can change that
color.

For ordinary widgets this is available

https://developer.gnome.org/gtk3/stable/GtkStyleContext.html#gtk-style-
context-get-background-color

but it is already deprecated.

So we need access to the general background color, so that we can
modify it, or access to a highlighted background color variant, which
we can set.

I think there is a "highlight current line" function somewhere hidden
in the code -- it is possible to apply that method to lines with
compiler errors?

Best regards,

Stefan Salewski



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]