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 | |
parent | 363a2bc9b15fb0b6cf2d5840d6c7cdcfe9bd8074 (diff) | |
download | busybox-w32-616e4699d2d54518b6bdf5534a8b81bed9e63e77.tar.gz busybox-w32-616e4699d2d54518b6bdf5534a8b81bed9e63e77.tar.bz2 busybox-w32-616e4699d2d54518b6bdf5534a8b81bed9e63e77.zip |
vi: rearrange functions, no logic changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-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) | |||
2444 | tcsetattr_stdin_TCSANOW(&term_orig); | 2444 | tcsetattr_stdin_TCSANOW(&term_orig); |
2445 | } | 2445 | } |
2446 | 2446 | ||
2447 | #if ENABLE_FEATURE_VI_USE_SIGNALS | ||
2448 | static void winch_handler(int sig UNUSED_PARAM) | ||
2449 | { | ||
2450 | int save_errno = errno; | ||
2451 | // FIXME: do it in main loop!!! | ||
2452 | signal(SIGWINCH, winch_handler); | ||
2453 | query_screen_dimensions(); | ||
2454 | new_screen(rows, columns); // get memory for virtual screen | ||
2455 | redraw(TRUE); // re-draw the screen | ||
2456 | errno = save_errno; | ||
2457 | } | ||
2458 | static void tstp_handler(int sig UNUSED_PARAM) | ||
2459 | { | ||
2460 | int save_errno = errno; | ||
2461 | |||
2462 | // ioctl inside cookmode() was seen to generate SIGTTOU, | ||
2463 | // stopping us too early. Prevent that: | ||
2464 | signal(SIGTTOU, SIG_IGN); | ||
2465 | |||
2466 | go_bottom_and_clear_to_eol(); | ||
2467 | cookmode(); // terminal to "cooked" | ||
2468 | |||
2469 | // stop now | ||
2470 | //signal(SIGTSTP, SIG_DFL); | ||
2471 | //raise(SIGTSTP); | ||
2472 | raise(SIGSTOP); // avoid "dance" with TSTP handler - use SIGSTOP instead | ||
2473 | //signal(SIGTSTP, tstp_handler); | ||
2474 | |||
2475 | // we have been "continued" with SIGCONT, restore screen and termios | ||
2476 | rawmode(); // terminal to "raw" | ||
2477 | last_status_cksum = 0; // force status update | ||
2478 | redraw(TRUE); // re-draw the screen | ||
2479 | |||
2480 | errno = save_errno; | ||
2481 | } | ||
2482 | static void int_handler(int sig) | ||
2483 | { | ||
2484 | signal(SIGINT, int_handler); | ||
2485 | siglongjmp(restart, sig); | ||
2486 | } | ||
2487 | #endif /* FEATURE_VI_USE_SIGNALS */ | ||
2488 | |||
2489 | static int mysleep(int hund) // sleep for 'hund' 1/100 seconds or stdin ready | 2447 | static int mysleep(int hund) // sleep for 'hund' 1/100 seconds or stdin ready |
2490 | { | 2448 | { |
2491 | struct pollfd pfd[1]; | 2449 | struct pollfd pfd[1]; |
@@ -3103,6 +3061,48 @@ static void refresh(int full_screen) | |||
3103 | #undef old_offset | 3061 | #undef old_offset |
3104 | } | 3062 | } |
3105 | 3063 | ||
3064 | #if ENABLE_FEATURE_VI_USE_SIGNALS | ||
3065 | static void winch_handler(int sig UNUSED_PARAM) | ||
3066 | { | ||
3067 | int save_errno = errno; | ||
3068 | // FIXME: do it in main loop!!! | ||
3069 | signal(SIGWINCH, winch_handler); | ||
3070 | query_screen_dimensions(); | ||
3071 | new_screen(rows, columns); // get memory for virtual screen | ||
3072 | redraw(TRUE); // re-draw the screen | ||
3073 | errno = save_errno; | ||
3074 | } | ||
3075 | static void tstp_handler(int sig UNUSED_PARAM) | ||
3076 | { | ||
3077 | int save_errno = errno; | ||
3078 | |||
3079 | // ioctl inside cookmode() was seen to generate SIGTTOU, | ||
3080 | // stopping us too early. Prevent that: | ||
3081 | signal(SIGTTOU, SIG_IGN); | ||
3082 | |||
3083 | go_bottom_and_clear_to_eol(); | ||
3084 | cookmode(); // terminal to "cooked" | ||
3085 | |||
3086 | // stop now | ||
3087 | //signal(SIGTSTP, SIG_DFL); | ||
3088 | //raise(SIGTSTP); | ||
3089 | raise(SIGSTOP); // avoid "dance" with TSTP handler - use SIGSTOP instead | ||
3090 | //signal(SIGTSTP, tstp_handler); | ||
3091 | |||
3092 | // we have been "continued" with SIGCONT, restore screen and termios | ||
3093 | rawmode(); // terminal to "raw" | ||
3094 | last_status_cksum = 0; // force status update | ||
3095 | redraw(TRUE); // re-draw the screen | ||
3096 | |||
3097 | errno = save_errno; | ||
3098 | } | ||
3099 | static void int_handler(int sig) | ||
3100 | { | ||
3101 | signal(SIGINT, int_handler); | ||
3102 | siglongjmp(restart, sig); | ||
3103 | } | ||
3104 | #endif /* FEATURE_VI_USE_SIGNALS */ | ||
3105 | |||
3106 | static void do_cmd(int c); | 3106 | static void do_cmd(int c); |
3107 | 3107 | ||
3108 | static int find_range(char **start, char **stop, char c) | 3108 | static int find_range(char **start, char **stop, char c) |