X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=libchimara%2Finput.c;h=648f44f03ae0a16c880071d433ec0093844ad123;hb=0edb4482f7a5d5de3b2fe82ad9a4b977eacb8721;hp=4bb92645402f254461a37eb95781d2857820a336;hpb=cb434cde33f75d939c6b10eabea3ab21f05f2810;p=rodin%2Fchimara.git diff --git a/libchimara/input.c b/libchimara/input.c index 4bb9264..648f44f 100644 --- a/libchimara/input.c +++ b/libchimara/input.c @@ -1,6 +1,7 @@ #include "charset.h" #include "magic.h" #include "input.h" +#include "pager.h" #include "chimara-glk-private.h" extern GPrivate *glk_data_key; @@ -293,6 +294,8 @@ glk_request_line_event_uni(winid_t win, glui32 *buf, glui32 maxlen, glui32 initl if(glk_data->register_arr) win->buffer_rock = (*glk_data->register_arr)(buf, maxlen, "&+#!Iu"); + + win->input_request_type = INPUT_REQUEST_LINE_UNICODE; win->line_input_buffer_unicode = buf; win->line_input_buffer_max_len = maxlen; @@ -417,8 +420,14 @@ on_shutdown_key_press_event(GtkWidget *widget, GdkEventKey *event, winid_t win) gboolean on_char_input_key_press_event(GtkWidget *widget, GdkEventKey *event, winid_t win) { + /* Ignore modifier keys, otherwise the char input will already trigger on + the shift key when the user tries to type a capital letter */ if(event->is_modifier) return FALSE; /* don't stop the event */ + + /* All text up to the input position is now regarded as being read by the user */ + if(win->type == wintype_TextBuffer) + pager_update(win); glui32 keycode = keyval_to_glk_keycode(event->keyval, win->input_request_type == INPUT_REQUEST_CHARACTER_UNICODE); @@ -440,6 +449,8 @@ on_line_input_key_press_event(GtkWidget *widget, GdkEventKey *event, winid_t win switch(win->type) { case wintype_TextBuffer: + /* All text up to the input position is now regarded as being read by the user */ + pager_update(win); /* History up/down */ if(event->keyval == GDK_Up || event->keyval == GDK_KP_Up