Line input echo won't affect current request
authorP. F. Chimento <philip.chimento@gmail.com>
Wed, 20 Apr 2011 15:36:03 +0000 (17:36 +0200)
committerP. F. Chimento <philip.chimento@gmail.com>
Wed, 20 Apr 2011 15:36:03 +0000 (17:36 +0200)
When turning line input echoing on or off, the window's currently
active line input request should be unaffected, according to the spec.

libchimara/input.c
libchimara/window.c
libchimara/window.h

index ff3cfb8b7b9eb09db3e3bff7fae2c4f26adbe180..0bcfd4ddec725a61bb62b77bddad78a3bfddc539 100644 (file)
@@ -243,6 +243,7 @@ glk_request_line_event(winid_t win, char *buf, glui32 maxlen, glui32 initlen)
        win->input_request_type = INPUT_REQUEST_LINE;
        win->line_input_buffer = buf;
        win->line_input_buffer_max_len = maxlen;
+       win->echo_current_line_input = win->echo_line_input;
 
        gchar *inserttext = (initlen > 0)? g_strndup(buf, initlen) : g_strdup("");
        switch(win->type)
@@ -634,7 +635,7 @@ finish_text_buffer_line_input(winid_t win, gboolean emit_signal)
        gchar *inserted_text = gtk_text_buffer_get_text(window_buffer, &start_iter, &end_iter, FALSE);
 
        /* If echoing is turned off, remove the text from the window */
-       if(!win->echo_line_input)
+       if(!win->echo_current_line_input)
                gtk_text_buffer_delete(window_buffer, &start_iter, &end_iter);
 
        /* Don't include the newline in the input */
@@ -929,7 +930,7 @@ force_line_input_from_queue(winid_t win, event_t *event)
                gtk_text_view_set_editable(GTK_TEXT_VIEW(win->widget), FALSE);
 
                /* Insert the forced input into the window */
-               if(win->echo_line_input)
+               if(win->echo_current_line_input)
                {
                        gtk_text_buffer_get_end_iter(buffer, &end);
                        gchar *text_to_insert = g_strconcat(text, "\n", NULL);
index 25c06bc89b2f35d0547cc1c0f43d26c3358df88f..41bd9f0f6856928664acebda755380a669a20495 100644 (file)
@@ -34,6 +34,7 @@ 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;
 
        /* Initialise the buffer */
        win->buffer = g_string_sized_new(1024);
index 8cd6e7d693c35499c4f57f30eb5fd81e3ba40c2a..58a840f05024ca19d8035a34998eb917c1b5f02c 100644 (file)
@@ -64,7 +64,9 @@ struct glk_window_struct
        gboolean mouse_input_requested;
        GList *history;
        GList *history_pos;
+       /* Line input echoing (text buffers only) */
        gboolean echo_line_input;
+       gboolean echo_current_line_input;
        /* Line input field (text grids only) */
        glui32 input_length;
        GtkTextChildAnchor *input_anchor;