From 007d80fedce14ccf35ec671a449b8d3c824b1ed6 Mon Sep 17 00:00:00 2001 From: "P. F. Chimento" Date: Wed, 20 Apr 2011 17:36:03 +0200 Subject: [PATCH] Line input echo won't affect current request 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 | 5 +++-- libchimara/window.c | 1 + libchimara/window.h | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libchimara/input.c b/libchimara/input.c index ff3cfb8..0bcfd4d 100644 --- a/libchimara/input.c +++ b/libchimara/input.c @@ -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); diff --git a/libchimara/window.c b/libchimara/window.c index 25c06bc..41bd9f0 100644 --- a/libchimara/window.c +++ b/libchimara/window.c @@ -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); diff --git a/libchimara/window.h b/libchimara/window.h index 8cd6e7d..58a840f 100644 --- a/libchimara/window.h +++ b/libchimara/window.h @@ -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; -- 2.30.2