- if(ev.type == evtype_CharInput) {
- glk_window_get_size(mainwin, &width, &height);
- fprintf(stderr, "\nWidth: %d\nHeight: %d\n", width, height);
- }
- //}
- glk_window_close(subwin, NULL);
- printf("closed window\n");
+ if(ev.type == evtype_LineInput)
+ break;
+ }
+
+ fprintf(stderr, "Now edit your previous line input\n");
+ glk_window_move_cursor(mainwin, 10, 22);
+ glk_request_line_event(mainwin, buffer, 256, strlen(buffer));
+ while(1) {
+ glk_select(&ev);
+ if(ev.type == evtype_LineInput)
+ break;
+ }
+
+ char *text = calloc(ev.val1 + 1, sizeof(char));
+ assert(text);
+ strncpy(text, buffer, ev.val1);
+ text[ev.val1] = '\0';
+ fprintf(stderr, "Your string was: '%s'.\nPress another key to clear the window and exit.\n", text);
+ free(text);
+ glk_request_char_event(mainwin);
+ while(1) {
+ glk_select(&ev);
+ if(ev.type == evtype_CharInput)
+ break;
+ }
+
+ glk_window_clear(mainwin);
+ free(buffer);