Hi Doug, 

I would consider it a usability bug but not necessarily a textview widget bug. 
If you add text, that doesn't have an indent tag, to the start of the line then 
it doesn't get indented. I suppose you could check the whole line for an indent 
tag but that would go against performance. This one might be up to the 
application developer to deal with.

You could use spaces instead of tags depending on what is needed. To tag the 
inserted text at the start of the line you could check if there is an indent 
tag, and if there is, apply an indent tag to the newly inserted text.

You can check bugzilla to see if there are any bugs reported that are similar. 
There is a link here.

https://www.gtk.org/development.php

Eric

...
g_signal_connect_after(buffer, "insert-text", G_CALLBACK(insert_text), NULL);
...
static void insert_text(GtkTextBuffer *buffer, GtkTextIter *location, gchar 
*text, gint len, gpointer data)
  {
    g_print("Text %s len %i offset %i\n", text, len, 
gtk_text_iter_get_offset(location));
    GtkTextTagTable *table=gtk_text_buffer_get_tag_table(buffer);
    GtkTextTag *indent_tag=gtk_text_tag_table_lookup(table, "indent");
    GtkTextIter *start=gtk_text_iter_copy(location);
    gtk_text_iter_backward_chars(start, len);
    if(gtk_text_iter_has_tag(location, indent_tag))
      {
        g_print("Indent Tag\n");
        gtk_text_buffer_apply_tag(buffer, indent_tag, start, location);
      }
    gtk_text_iter_free(start);
  }
...

 


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to