[prev in list] [next in list] [prev in thread] [next in thread]
List: gtk-app-devel
Subject: GtkSourceCompletion skip lines
From: alpha150 () free ! fr
Date: 2015-05-13 8:14:18
Message-ID: 1143271743.221923149.1431504858833.JavaMail.root () spooler3-g27 ! priv ! proxad ! net
[Download RAW message or body]
Hi,
I'm using gtksourceview 2.10.x on win32. GtkSourceCompletion skip lines, for example \
with the following code: #define ABCD
#define ABCDE
Only ABCD will be available for completion.
My source code is the following:
textview_ea_h = gtk_text_view_new();
GtkTextBuffer * buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview_ea_h));
//////////////////////////////////////////
// Load the file into the textview:
GtkTextIter start;
GtkTextIter end;
gchar read_buf[4097];
FILE * file = fopen("ea.h","rb");
fseek(file,0,SEEK_END);
unsigned int len = ftell(file);
rewind(file);
gtk_text_buffer_get_start_iter(GTK_TEXT_BUFFER(buf),&start);
gtk_text_buffer_get_end_iter(GTK_TEXT_BUFFER(buf),&end);
gtk_text_buffer_delete(GTK_TEXT_BUFFER(buf), &start, &end);
gchar * buf_utf8;
while(fgets(read_buf,4097,file)) {
gtk_text_buffer_get_end_iter(GTK_TEXT_BUFFER(buf),&end);
buf_utf8 = g_locale_to_utf8(read_buf, -1, NULL, NULL, NULL);
gtk_text_buffer_insert(GTK_TEXT_BUFFER(buf), &end, buf_utf8, -1);
g_free (buf_utf8);
}
gtk_text_buffer_set_modified (GTK_TEXT_BUFFER (buf), TRUE);
fclose(file);
// End load of file.
/////////////////////////////////////////
source_completion_words_ea_h = gtk_source_completion_words_new("ea.h", NULL);
gtk_source_completion_words_register(source_completion_words_ea_h, \
GTK_TEXT_BUFFER(buf));
l->source_completion = gtk_source_view_get_completion(GTK_SOURCE_VIEW(l->editor));
GError *error = NULL;
gtk_source_completion_add_provider(l->source_completion,
\
GTK_SOURCE_COMPLETION_PROVIDER(source_completion_words_ea_h),&error); if(error != \
NULL) g_error_free(error);
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic