From c4a18ec8a7c6c65c196ce6735e2fa7e4febf3a06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Fri, 15 Jan 2016 05:36:58 +0100 Subject: [PATCH] degesch: fix and simplify screen handling Now with less madness. --- degesch.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/degesch.c b/degesch.c index 2030647..854ad84 100644 --- a/degesch.c +++ b/degesch.c @@ -59,9 +59,7 @@ enum #include #include -#ifdef TIOCGWINSZ #include -#endif // ! TIOCGWINSZ #include #include @@ -3418,6 +3416,7 @@ buffer_print_backlog (struct app_context *ctx, struct buffer *buffer) else if (cursor_address) tputs (tparm (cursor_address, g_terminal.lines - 1, 0, 0, 0, 0, 0, 0, 0, 0), 1, printer); + fflush (stdout); } else { @@ -11046,24 +11045,18 @@ resume_terminal (struct app_context *ctx) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -static bool +static void redraw_screen (struct app_context *ctx) { - if (!soft_assert (clear_screen != NULL)) - return false; - input_hide (&ctx->input); // If by some circumstance we had the wrong idea input_on_terminal_resized (&ctx->input); + update_screen_size (); - terminal_printer_fn printer = get_attribute_printer (stdout); - tputs (clear_screen, 1, printer); - fflush (stdout); buffer_print_backlog (ctx, ctx->current_buffer); input_show (&ctx->input); - return true; } static bool @@ -11394,8 +11387,7 @@ on_readline_redraw_screen (int count, int key) (void) key; struct app_context *ctx = g_ctx; - if (!redraw_screen (ctx)) - input_ding (&ctx->input); + redraw_screen (ctx); return 0; } @@ -11606,8 +11598,7 @@ on_editline_redraw_screen (EditLine *editline, int key) (void) editline; (void) key; - if (!redraw_screen (g_ctx)) - return CC_ERROR; + redraw_screen (g_ctx); return CC_NORM; } @@ -12054,10 +12045,7 @@ on_signal_pipe_readable (const struct pollfd *fd, struct app_context *ctx) if (g_winch_received) { - if (ctx->input.active) - input_on_terminal_resized (&ctx->input); - - update_screen_size (); + redraw_screen (ctx); g_winch_received = false; } }