Special Portal commit
[rodin/chimara.git] / libchimara / window.c
index a31bed1b251f7b749d82a325a2b058c599bd4b93..8e83b9d194f92c080bcef3020bcd721785297f34 100644 (file)
@@ -30,6 +30,7 @@ window_new_common(glui32 rock)
        win->input_request_type = INPUT_REQUEST_NONE;
        win->line_input_buffer = NULL;
        win->line_input_buffer_unicode = NULL;
+       win->history = NULL;
 
        /* Initialise the buffer */
        win->buffer = g_string_sized_new(1024);
@@ -52,6 +53,9 @@ window_close_common(winid_t win, gboolean destroy_node)
                g_node_destroy(win->window_node);
        win->magic = MAGIC_FREE;
 
+       g_list_foreach(win->history, g_free, NULL);
+       g_list_free(win->history);
+
        g_string_free(win->buffer, TRUE);
        g_free(win);
 }
@@ -1145,6 +1149,7 @@ glk_window_get_size(winid_t win, glui32 *widthptr, glui32 *heightptr)
 void
 glk_window_set_arrangement(winid_t win, glui32 method, glui32 size, winid_t keywin)
 {
+       printf("set_arrangement(%d)\n", size);
        VALID_WINDOW(win, return);
        VALID_WINDOW_OR_NULL(keywin, return);
        g_return_if_fail(win->type == wintype_Pair);
@@ -1232,6 +1237,8 @@ glk_window_move_cursor(winid_t win, glui32 xpos, glui32 ypos)
        VALID_WINDOW(win, return);
        g_return_if_fail(win->type == wintype_TextGrid);
 
+       flush_window_buffer(win);
+
        ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key);
        
        /* Wait until the window's size is current */
@@ -1250,6 +1257,7 @@ glk_window_move_cursor(winid_t win, glui32 xpos, glui32 ypos)
            ypos += xpos / win->width;
            xpos %= win->width;
        }
+
        /* Go to the end if the cursor is moved off the bottom edge */
        if(ypos >= win->height)
        {