* Added initial support for styles! (no style hints as of yet though)
[rodin/chimara.git] / src / strio.c
index 9baaf0fe7a191631a4d057be9de5d7831f3a422b..921b75cc771f0331828220061dbfc9030726fcd1 100644 (file)
 static void
 write_utf8_to_grid(winid_t win, gchar *s)
 {
+       if(win->input_request_type == INPUT_REQUEST_LINE || win->input_request_type == INPUT_REQUEST_LINE_UNICODE)
+       {
+               ILLEGAL("Tried to print to a text grid window with line input pending.");
+               return;
+       }
+       
     /* Number of characters to insert */
     glong length = g_utf8_strlen(s, -1);
     glong chars_left = length;
@@ -59,13 +65,19 @@ write_utf8_to_grid(winid_t win, gchar *s)
 static void
 write_utf8_to_window(winid_t win, gchar *s)
 {
+       if(win->input_request_type == INPUT_REQUEST_LINE || win->input_request_type == INPUT_REQUEST_LINE_UNICODE)
+       {
+               ILLEGAL("Tried to print to a text buffer window with line input pending.");
+               return;
+       }
+       
        gdk_threads_enter();
 
        GtkTextBuffer *buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(win->widget) );
 
        GtkTextIter iter;
        gtk_text_buffer_get_end_iter(buffer, &iter);
-       gtk_text_buffer_insert(buffer, &iter, s, -1);
+       gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, s, -1, win->window_stream->style, NULL);
 
        gdk_threads_leave();
 }
@@ -459,7 +471,7 @@ is_unicode_newline(glsi32 ch, FILE *fp, gboolean utf8)
 /* Internal function: Read one character from a stream. Returns a value which
  can be returned unchanged by glk_get_char_stream_uni(), but 
  glk_get_char_stream() must replace high values by the placeholder character. */
-glsi32
+static glsi32
 get_char_stream_common(strid_t str)
 {
        switch(str->type)