
#include <stdio.h>
#include <gtk/gtk.h>

int main(int   argc,
         char *argv[])
{
    GtkTextBuffer *a;
    GtkTextBuffer *b;
    GtkTextIter i;
    GtkTextIter e;

    gtk_init (&argc, &argv);

    printf("\nInserting split pair\n");
    a = gtk_text_buffer_new(NULL);

    gtk_text_buffer_get_end_iter(a, &e);
    gtk_text_buffer_insert(a, &e, "1\r", -1);
    gtk_text_buffer_insert(a, &e, "\n2", -1);

    gtk_text_buffer_get_start_iter(a, &i);
    while (!gtk_text_iter_equal(&i, &e)) {
        printf("%d, %d\n", (int) gtk_text_iter_get_char(&i), gtk_text_iter_get_line(&i));
        if (!gtk_text_iter_forward_char(&i)) {
            break;
        }
    }

    printf("\nInserting joined pair\n");
    b = gtk_text_buffer_new(NULL);
    
    gtk_text_buffer_get_end_iter(b, &e);
    gtk_text_buffer_insert(b, &e, "1\r\n", -1);
    gtk_text_buffer_insert(b, &e, "2", -1);
    
    gtk_text_buffer_get_start_iter(b, &i);
    while (!gtk_text_iter_equal(&i, &e)) {
        printf("%d, %d\n", (int) gtk_text_iter_get_char(&i), gtk_text_iter_get_line(&i));
        if (!gtk_text_iter_forward_char(&i)) {
            break;
        }
    }

    return 0;
}
