Ejemplo n.º 1
0
void snippets_activate (GuSnippets* sc, GuEditor* ec, gchar* key) {
    gchar* snippet = NULL;
    GuSnippetInfo* new_info = NULL;
    GtkTextIter start, end;

    slog (L_DEBUG, "Snippet `%s' activated\n", key);

    snippet = snippets_get_value (sc, key);
    g_return_if_fail (snippet != NULL);

    new_info = snippets_parse (snippet);

    gtk_text_buffer_get_selection_bounds (ec_buffer, &start, &end);
    new_info->start_offset = gtk_text_iter_get_offset (&start);
    new_info->sel_text = gtk_text_iter_get_text (&start, &end);
    GSList* marks = gtk_text_iter_get_marks (&start);
    new_info->sel_start = *GTK_TEXT_MARK (marks->data);
    g_slist_free (marks);

    gtk_text_buffer_insert (ec_buffer, &start, new_info->expanded, -1);
    snippet_info_create_marks (new_info, ec);
    snippet_info_initial_expand (new_info, ec);
    gtk_text_buffer_set_modified (ec_buffer, TRUE);

    if (sc->info) {
        snippet_info_sync_group (sc->info, ec);
        sc->stackframe = g_list_append (sc->stackframe, sc->info);
    }
    sc->info = new_info;

    if (!snippet_info_goto_next_placeholder (sc->info, ec))
        snippets_deactivate (sc, ec);
}
Ejemplo n.º 2
0
CAMLprim value ml_gtk_text_iter_get_marks(value ti) {
  return Val_GSList_free(gtk_text_iter_get_marks(GtkTextIter_val(ti)),
                         Val_GtkTextMark_func);
}
Ejemplo n.º 3
0
static VALUE
rg_marks(VALUE self)
{
    return GSLIST2ARYF(gtk_text_iter_get_marks(_SELF(self)));
}