gtksourceview

Gedit syntax-highlighting with gtksourceview for backreferencing sub-patterns?

十年热恋 提交于 2019-12-24 10:41:29
问题 The following will highlight "timeout" on the second line but will not highlight it ever again. Does gtksourceview support some sort of backreference on the "sub-pattern" that will match all instances throughout the file ? gtksourceview website manual /usr/share/gtksourceview-2.0/language-specs/c.lang <context id="struct" style-ref="struct"> <match>\bstruct\b\s\w+\s(\w+)</match> <include> <context sub-pattern="1" style-ref="structname"/> </include> </context> int ns; struct timeval timeout;

gtksourceview2: implement completion provider

纵饮孤独 提交于 2019-12-23 18:44:59
问题 The documentation states about SourceCompletionProvider : You must implement this interface to provide proposals to SourceCompletion What does "implement this interface" means in the context? Should I create new GObject using this functions? Any example?. When I have new GObject , then how can I add functions (like sourceCompletionProviderGetName ) to it? Thanks 回答1: gtk+ is written in C, however it uses glib to provide an object-oriented style interface. Much of the gtk+ API is defined using

Matching entire string in gtksourceview

狂风中的少年 提交于 2019-12-23 16:08:01
问题 Take this short XML snippet for defining strings in gtksourceview: <context id="string" style-ref="string" end-at-line-end="true"> <start>"</start> <end>"</end> <include> <context id="special-string" style-ref="special"> <match>(foo|bar)</match> </context> <context ref="def:line-continue"/> </include> </context> This highlights any instances of "foo" or "bar" inside a string. Suppose I want to highlight these two when they are the entire string, so that "foo" has the middle three characters

Load GUI from a Glade with GtkSourceView in PyGObject

隐身守侯 提交于 2019-12-12 08:37:31
问题 I'm trying to use a Glade file that has a GtkSourceView widget in PyGObject. I've wrote a little guide on how to start using the new GtkSourceView 3.0 in Glade: http://cjenkins.wordpress.com/2012/05/08/use-gtksourceview-widget-in-glade/ The problem is when I want to load that Glade from PyGObject: from gi.repository import Gtk, GtkSource from os.path import abspath, dirname, join WHERE_AM_I = abspath(dirname(__file__)) class MyApp(object): def __init__(self): self.builder = Gtk.Builder() self

How to apply style using GtkSourceView library

故事扮演 提交于 2019-12-11 07:38:50
问题 I'm trying to style a GtkSourceView object in particular I'd like to change the color of line numbers. I'm reading https://developer.gnome.org/gtksourceview/stable/style-reference.html. I'm able to change text but not line-numbers . The document says: line-numbers : Text and background colors for the left margin, on which line numbers are drawn. This is the source: #include <gtk/gtk.h> #include <gtksourceview/gtksource.h> int main (int argc, char *argv[]) { GtkWidget *window, *scrolled_win,

how to (programmatically) scroll to a specific line in gtktextview/gtksourceview

拜拜、爱过 提交于 2019-12-10 20:29:59
问题 I am creating a text editor as a way of getting more familiar with C and gtk+. I am using gtk+-2.0 & gtksourceview-2.0, and gtk_scrolled_window . As a first attempt at creating a goto function browser I thought I would just simply create an array of functions found in the document and a corresponding array of lines on which they occur. I have that much done. I was surprised to find that there is no goto line capability that I can easily find in devhelp. It sounds like gtk_text_view_scroll_to

Load GUI from a Glade with GtkSourceView in PyGObject

匆匆过客 提交于 2019-12-04 03:54:30
I'm trying to use a Glade file that has a GtkSourceView widget in PyGObject. I've wrote a little guide on how to start using the new GtkSourceView 3.0 in Glade: http://cjenkins.wordpress.com/2012/05/08/use-gtksourceview-widget-in-glade/ The problem is when I want to load that Glade from PyGObject: from gi.repository import Gtk, GtkSource from os.path import abspath, dirname, join WHERE_AM_I = abspath(dirname(__file__)) class MyApp(object): def __init__(self): self.builder = Gtk.Builder() self.glade_file = join(WHERE_AM_I, 'test.glade') self.builder.add_from_file(self.glade_file) if __name__ ==