Fixed a bug with newlines in line input on text buffer windows.
authorPhilip Chimento <philip.chimento@gmail.com>
Sun, 1 Mar 2009 23:31:01 +0000 (23:31 +0000)
committerPhilip Chimento <philip.chimento@gmail.com>
Sun, 1 Mar 2009 23:31:01 +0000 (23:31 +0000)
git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@28 ddfedd41-794f-dd11-ae45-00112f111e67

src/input.c
src/main.c

index bcd5116757446413bcd6d48005e8b52c483eca74..7eebfa596ac2e85324cb8c2917ec80d15dded6e5 100644 (file)
@@ -378,7 +378,10 @@ end_line_input_request(winid_t win, const gchar *inserted_text)
 }
 
 /* Internal function: Callback for signal insert-text on a text buffer window.
 }
 
 /* Internal function: Callback for signal insert-text on a text buffer window.
-Runs after the default handler has already inserted the text.*/
+Runs after the default handler has already inserted the text.
+FIXME: This function assumes that newline was the last character typed into the
+window. That assumption is wrong if, for example, text containing a newline was
+pasted into the window. */
 void
 after_window_insert_text(GtkTextBuffer *textbuffer, GtkTextIter *location, gchar *text, gint len, winid_t win) 
 {
 void
 after_window_insert_text(GtkTextBuffer *textbuffer, GtkTextIter *location, gchar *text, gint len, winid_t win) 
 {
@@ -396,6 +399,7 @@ after_window_insert_text(GtkTextBuffer *textbuffer, GtkTextIter *location, gchar
         GtkTextMark *input_position = gtk_text_buffer_get_mark(window_buffer, "input_position");
         gtk_text_buffer_get_iter_at_mark(window_buffer, &start_iter, input_position);
         gtk_text_buffer_get_end_iter(window_buffer, &end_iter);
         GtkTextMark *input_position = gtk_text_buffer_get_mark(window_buffer, "input_position");
         gtk_text_buffer_get_iter_at_mark(window_buffer, &start_iter, input_position);
         gtk_text_buffer_get_end_iter(window_buffer, &end_iter);
+               gtk_text_iter_backward_cursor_position(&end_iter); /* don't include \n */
         
         inserted_text = gtk_text_buffer_get_text(window_buffer, &start_iter, &end_iter, FALSE);
 
         
         inserted_text = gtk_text_buffer_get_text(window_buffer, &start_iter, &end_iter, FALSE);
 
index fd2700d48651379122af5d4aaa3e4e226c935f3d..324e49e1a2201bf692e15ca617402c096a250843 100644 (file)
@@ -115,7 +115,7 @@ main(int argc, char *argv[])
 
        g_object_unref( G_OBJECT(builder) );
 
 
        g_object_unref( G_OBJECT(builder) );
 
-    if( !chimara_glk_run(CHIMARA_GLK(glk), ".libs/gridtest.so", &error) ) {
+    if( !chimara_glk_run(CHIMARA_GLK(glk), ".libs/first.so", &error) ) {
         error_dialog(GTK_WINDOW(window), error, "Error starting Glk library: ");
         return 1;
     }
         error_dialog(GTK_WINDOW(window), error, "Error starting Glk library: ");
         return 1;
     }