summaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2016-01-15 05:36:58 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2016-01-15 05:40:20 +0100
commitc4a18ec8a7c6c65c196ce6735e2fa7e4febf3a06 (patch)
treed8e54857ce1809ae75f34e1c03a92e84b0d8cdea /degesch.c
parentd0db1a6cdc7081af1de58683ed38f8aace267375 (diff)
downloadxK-c4a18ec8a7c6c65c196ce6735e2fa7e4febf3a06.tar.gz
xK-c4a18ec8a7c6c65c196ce6735e2fa7e4febf3a06.tar.xz
xK-c4a18ec8a7c6c65c196ce6735e2fa7e4febf3a06.zip
degesch: fix and simplify screen handling
Now with less madness.
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c24
1 files 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 <wchar.h>
#include <termios.h>
-#ifdef TIOCGWINSZ
#include <sys/ioctl.h>
-#endif // ! TIOCGWINSZ
#include <curses.h>
#include <term.h>
@@ -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;
}
}