degesch: fix and simplify screen handling
Now with less madness.
This commit is contained in:
parent
d0db1a6cdc
commit
c4a18ec8a7
24
degesch.c
24
degesch.c
@ -59,9 +59,7 @@ enum
|
|||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#ifdef TIOCGWINSZ
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#endif // ! TIOCGWINSZ
|
|
||||||
|
|
||||||
#include <curses.h>
|
#include <curses.h>
|
||||||
#include <term.h>
|
#include <term.h>
|
||||||
@ -3418,6 +3416,7 @@ buffer_print_backlog (struct app_context *ctx, struct buffer *buffer)
|
|||||||
else if (cursor_address)
|
else if (cursor_address)
|
||||||
tputs (tparm (cursor_address, g_terminal.lines - 1,
|
tputs (tparm (cursor_address, g_terminal.lines - 1,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0), 1, printer);
|
0, 0, 0, 0, 0, 0, 0, 0), 1, printer);
|
||||||
|
fflush (stdout);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -11046,24 +11045,18 @@ resume_terminal (struct app_context *ctx)
|
|||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
static bool
|
static void
|
||||||
redraw_screen (struct app_context *ctx)
|
redraw_screen (struct app_context *ctx)
|
||||||
{
|
{
|
||||||
if (!soft_assert (clear_screen != NULL))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
input_hide (&ctx->input);
|
input_hide (&ctx->input);
|
||||||
|
|
||||||
// If by some circumstance we had the wrong idea
|
// If by some circumstance we had the wrong idea
|
||||||
input_on_terminal_resized (&ctx->input);
|
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);
|
buffer_print_backlog (ctx, ctx->current_buffer);
|
||||||
|
|
||||||
input_show (&ctx->input);
|
input_show (&ctx->input);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@ -11394,8 +11387,7 @@ on_readline_redraw_screen (int count, int key)
|
|||||||
(void) key;
|
(void) key;
|
||||||
|
|
||||||
struct app_context *ctx = g_ctx;
|
struct app_context *ctx = g_ctx;
|
||||||
if (!redraw_screen (ctx))
|
redraw_screen (ctx);
|
||||||
input_ding (&ctx->input);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11606,8 +11598,7 @@ on_editline_redraw_screen (EditLine *editline, int key)
|
|||||||
(void) editline;
|
(void) editline;
|
||||||
(void) key;
|
(void) key;
|
||||||
|
|
||||||
if (!redraw_screen (g_ctx))
|
redraw_screen (g_ctx);
|
||||||
return CC_ERROR;
|
|
||||||
return CC_NORM;
|
return CC_NORM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12054,10 +12045,7 @@ on_signal_pipe_readable (const struct pollfd *fd, struct app_context *ctx)
|
|||||||
|
|
||||||
if (g_winch_received)
|
if (g_winch_received)
|
||||||
{
|
{
|
||||||
if (ctx->input.active)
|
redraw_screen (ctx);
|
||||||
input_on_terminal_resized (&ctx->input);
|
|
||||||
|
|
||||||
update_screen_size ();
|
|
||||||
g_winch_received = false;
|
g_winch_received = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user