diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2019-04-01 14:02:37 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2019-04-01 14:02:37 +0200 |
commit | 616e4699d2d54518b6bdf5534a8b81bed9e63e77 (patch) | |
tree | d32d10b527315c6a83295e2d77c61f5903abdf6f /editors | |
parent | 363a2bc9b15fb0b6cf2d5840d6c7cdcfe9bd8074 (diff) | |
download | busybox-616e4699d2d54518b6bdf5534a8b81bed9e63e77.tar.gz |
vi: rearrange functions, no logic changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'editors')
-rw-r--r-- | editors/vi.c | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/editors/vi.c b/editors/vi.c index cfb1a71ea..e960afc37 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -2444,48 +2444,6 @@ static void cookmode(void) tcsetattr_stdin_TCSANOW(&term_orig); } -#if ENABLE_FEATURE_VI_USE_SIGNALS -static void winch_handler(int sig UNUSED_PARAM) -{ - int save_errno = errno; - // FIXME: do it in main loop!!! - signal(SIGWINCH, winch_handler); - query_screen_dimensions(); - new_screen(rows, columns); // get memory for virtual screen - redraw(TRUE); // re-draw the screen - errno = save_errno; -} -static void tstp_handler(int sig UNUSED_PARAM) -{ - int save_errno = errno; - - // ioctl inside cookmode() was seen to generate SIGTTOU, - // stopping us too early. Prevent that: - signal(SIGTTOU, SIG_IGN); - - go_bottom_and_clear_to_eol(); - cookmode(); // terminal to "cooked" - - // stop now - //signal(SIGTSTP, SIG_DFL); - //raise(SIGTSTP); - raise(SIGSTOP); // avoid "dance" with TSTP handler - use SIGSTOP instead - //signal(SIGTSTP, tstp_handler); - - // we have been "continued" with SIGCONT, restore screen and termios - rawmode(); // terminal to "raw" - last_status_cksum = 0; // force status update - redraw(TRUE); // re-draw the screen - - errno = save_errno; -} -static void int_handler(int sig) -{ - signal(SIGINT, int_handler); - siglongjmp(restart, sig); -} -#endif /* FEATURE_VI_USE_SIGNALS */ - static int mysleep(int hund) // sleep for 'hund' 1/100 seconds or stdin ready { struct pollfd pfd[1]; @@ -3103,6 +3061,48 @@ static void refresh(int full_screen) #undef old_offset } +#if ENABLE_FEATURE_VI_USE_SIGNALS +static void winch_handler(int sig UNUSED_PARAM) +{ + int save_errno = errno; + // FIXME: do it in main loop!!! + signal(SIGWINCH, winch_handler); + query_screen_dimensions(); + new_screen(rows, columns); // get memory for virtual screen + redraw(TRUE); // re-draw the screen + errno = save_errno; +} +static void tstp_handler(int sig UNUSED_PARAM) +{ + int save_errno = errno; + + // ioctl inside cookmode() was seen to generate SIGTTOU, + // stopping us too early. Prevent that: + signal(SIGTTOU, SIG_IGN); + + go_bottom_and_clear_to_eol(); + cookmode(); // terminal to "cooked" + + // stop now + //signal(SIGTSTP, SIG_DFL); + //raise(SIGTSTP); + raise(SIGSTOP); // avoid "dance" with TSTP handler - use SIGSTOP instead + //signal(SIGTSTP, tstp_handler); + + // we have been "continued" with SIGCONT, restore screen and termios + rawmode(); // terminal to "raw" + last_status_cksum = 0; // force status update + redraw(TRUE); // re-draw the screen + + errno = save_errno; +} +static void int_handler(int sig) +{ + signal(SIGINT, int_handler); + siglongjmp(restart, sig); +} +#endif /* FEATURE_VI_USE_SIGNALS */ + static void do_cmd(int c); static int find_range(char **start, char **stop, char c) |