Skip to content
Snippets Groups Projects
Commit 8ff671d4 authored by Ivan Kosenko's avatar Ivan Kosenko Committed by Roman Tsisyk
Browse files

Fix input wrapping when terminal size changed

parent af63fcbe
No related branches found
No related tags found
No related merge requests found
...@@ -84,7 +84,7 @@ static char *pid_file = NULL; ...@@ -84,7 +84,7 @@ static char *pid_file = NULL;
static char **main_argv; static char **main_argv;
static int main_argc; static int main_argc;
/** Signals handled after start as part of the event loop. */ /** Signals handled after start as part of the event loop. */
static ev_signal ev_sigs[4]; static ev_signal ev_sigs[5];
static const int ev_sig_count = sizeof(ev_sigs)/sizeof(*ev_sigs); static const int ev_sig_count = sizeof(ev_sigs)/sizeof(*ev_sigs);
static double start_time; static double start_time;
...@@ -130,6 +130,15 @@ signal_cb(ev_loop *loop, struct ev_signal *w, int revents) ...@@ -130,6 +130,15 @@ signal_cb(ev_loop *loop, struct ev_signal *w, int revents)
ev_break(loop, EVBREAK_ALL); ev_break(loop, EVBREAK_ALL);
} }
static void
signal_sigwinch_cb(ev_loop *loop, struct ev_signal *w, int revents)
{
(void) loop;
(void) w;
(void) revents;
rl_resize_terminal();
}
/** Try to log as much as possible before dumping a core. /** Try to log as much as possible before dumping a core.
* *
* Core files are not aways allowed and it takes an effort to * Core files are not aways allowed and it takes an effort to
...@@ -210,6 +219,7 @@ signal_reset() ...@@ -210,6 +219,7 @@ signal_reset()
sigaction(SIGINT, &sa, NULL) == -1 || sigaction(SIGINT, &sa, NULL) == -1 ||
sigaction(SIGTERM, &sa, NULL) == -1 || sigaction(SIGTERM, &sa, NULL) == -1 ||
sigaction(SIGHUP, &sa, NULL) == -1 || sigaction(SIGHUP, &sa, NULL) == -1 ||
sigaction(SIGWINCH, &sa, NULL) == -1 ||
sigaction(SIGSEGV, &sa, NULL) == -1 || sigaction(SIGSEGV, &sa, NULL) == -1 ||
sigaction(SIGFPE, &sa, NULL) == -1) sigaction(SIGFPE, &sa, NULL) == -1)
say_syserror("sigaction"); say_syserror("sigaction");
...@@ -260,6 +270,7 @@ signal_init(void) ...@@ -260,6 +270,7 @@ signal_init(void)
ev_signal_init(&ev_sigs[1], signal_cb, SIGINT); ev_signal_init(&ev_sigs[1], signal_cb, SIGINT);
ev_signal_init(&ev_sigs[2], signal_cb, SIGTERM); ev_signal_init(&ev_sigs[2], signal_cb, SIGTERM);
ev_signal_init(&ev_sigs[3], signal_cb, SIGHUP); ev_signal_init(&ev_sigs[3], signal_cb, SIGHUP);
ev_signal_init(&ev_sigs[4], signal_sigwinch_cb, SIGWINCH);
for (int i = 0; i < ev_sig_count; i++) for (int i = 0; i < ev_sig_count; i++)
ev_signal_start(loop(), &ev_sigs[i]); ev_signal_start(loop(), &ev_sigs[i]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment