Fixed #20
[projects/chimara/chimara.git] / libchimara / window.c
index 25c06bc89b2f35d0547cc1c0f43d26c3358df88f..e54dfc3ae0f8cf4110333f3d566dc4114195be3b 100644 (file)
@@ -34,6 +34,9 @@ window_new_common(glui32 rock)
        win->line_input_buffer_unicode = NULL;
        win->history = NULL;
        win->echo_line_input = TRUE;
+       win->echo_current_line_input = TRUE;
+       win->extra_line_terminators = NULL;
+       win->current_extra_line_terminators = NULL;
 
        /* Initialise the buffer */
        win->buffer = g_string_sized_new(1024);
@@ -64,6 +67,8 @@ window_close_common(winid_t win, gboolean destroy_node)
        
        g_list_foreach(win->history, (GFunc)g_free, NULL);
        g_list_free(win->history);
+       g_slist_free(win->extra_line_terminators);
+       g_slist_free(win->current_extra_line_terminators);
        
        g_string_free(win->buffer, TRUE);
        g_hash_table_destroy(win->hyperlinks);
@@ -122,6 +127,8 @@ glk_window_iterate(winid_t win, glui32 *rockptr)
        if(retval && rockptr)
                *rockptr = glk_window_get_rock(retval);
                
+       if(retval)
+               printf("Returning window of type %d and rock %d\n", retval->type, retval->rock);
        return retval;
 }
 
@@ -197,8 +204,8 @@ glk_window_get_sibling(winid_t win)
        if(G_NODE_IS_ROOT(win->window_node))
                return NULL;
        if(win->window_node->next)
-               return (winid_t)win->window_node->next;
-       return (winid_t)win->window_node->prev;
+               return (winid_t)win->window_node->next->data;
+       return (winid_t)win->window_node->prev->data;
 }
 
 /**
@@ -457,8 +464,9 @@ glk_window_open(winid_t split, glui32 method, glui32 size, glui32 wintype,
                 glui32 rock)
 {
        VALID_WINDOW_OR_NULL(split, return NULL);
-       g_return_val_if_fail(method == (method & (winmethod_DirMask | winmethod_DivisionMask)), NULL);
-       g_return_val_if_fail(!(((method & winmethod_DivisionMask) == winmethod_Proportional) && size > 100), NULL);     
+       g_return_val_if_fail(!(((method & winmethod_DivisionMask) == winmethod_Proportional) && size > 100), NULL);
+       if(method != (method & (winmethod_DirMask | winmethod_DivisionMask | winmethod_BorderMask)))
+               WARNING("Unrecognized bits in method constant");
 
        ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key);