static void edition_pre_exec (void) { if (clear_before_exec) clr_scr (); else { if (!(mc_global.tty.console_flag != '\0' || mc_global.tty.xterm_flag)) printf ("\n\n"); } channels_down (); disable_mouse (); disable_bracketed_paste (); tty_reset_shell_mode (); tty_keypad (FALSE); tty_reset_screen (); numeric_keypad_mode (); /* on xterms: maybe endwin did not leave the terminal on the shell * screen page: do it now. * * Do not move this before endwin: in some systems rmcup includes * a call to clear screen, so it will end up clearing the shell screen. */ do_exit_ca_mode (); }
void toggle_panels (void) { #ifdef ENABLE_SUBSHELL vfs_path_t *new_dir_vpath = NULL; #endif /* ENABLE_SUBSHELL */ SIG_ATOMIC_VOLATILE_T was_sigwinch = 0; channels_down (); disable_mouse (); disable_bracketed_paste (); if (clear_before_exec) clr_scr (); if (mc_global.tty.alternate_plus_minus) numeric_keypad_mode (); #ifndef HAVE_SLANG /* With slang we don't want any of this, since there * is no raw_mode supported */ tty_reset_shell_mode (); #endif /* !HAVE_SLANG */ tty_noecho (); tty_keypad (FALSE); tty_reset_screen (); do_exit_ca_mode (); tty_raw_mode (); if (mc_global.tty.console_flag != '\0') handle_console (CONSOLE_RESTORE); #ifdef ENABLE_SUBSHELL if (mc_global.tty.use_subshell) { vfs_path_t **new_dir_p; new_dir_p = vfs_current_is_local ()? &new_dir_vpath : NULL; invoke_subshell (NULL, VISIBLY, new_dir_p); } else #endif /* ENABLE_SUBSHELL */ { if (output_starts_shell) { fprintf (stderr, _("Type 'exit' to return to the Midnight Commander")); fprintf (stderr, "\n\r\n\r"); my_system (EXECUTE_INTERNAL, mc_global.tty.shell, NULL); } else get_key_code (0); } if (mc_global.tty.console_flag != '\0') handle_console (CONSOLE_SAVE); do_enter_ca_mode (); tty_reset_prog_mode (); tty_keypad (TRUE); /* Prevent screen flash when user did 'exit' or 'logout' within subshell */ if ((quit & SUBSHELL_EXIT) != 0) { /* User did 'exit' or 'logout': quit MC */ if (quiet_quit_cmd ()) return; quit = 0; #ifdef ENABLE_SUBSHELL /* restart subshell */ if (mc_global.tty.use_subshell) init_subshell (); #endif /* ENABLE_SUBSHELL */ } enable_mouse (); enable_bracketed_paste (); channels_up (); if (mc_global.tty.alternate_plus_minus) application_keypad_mode (); /* HACK: * Save sigwinch flag that will be reset in mc_refresh() called via update_panels(). * There is some problem with screen redraw in ncurses-based mc in this situation. */ was_sigwinch = mc_global.tty.winch_flag; mc_global.tty.winch_flag = 0; #ifdef ENABLE_SUBSHELL if (mc_global.tty.use_subshell) { do_load_prompt (); if (new_dir_vpath != NULL) do_possible_cd (new_dir_vpath); if (mc_global.tty.console_flag != '\0' && output_lines) show_console_contents (output_start_y, LINES - mc_global.keybar_visible - output_lines - 1, LINES - mc_global.keybar_visible - 1); } vfs_path_free (new_dir_vpath); #endif /* ENABLE_SUBSHELL */ if (mc_global.mc_run_mode == MC_RUN_FULL) { update_panels (UP_OPTIMIZE, UP_KEEPSEL); update_xterm_title_path (); } if (was_sigwinch != 0 || mc_global.tty.winch_flag != 0) dialog_change_screen_size (); else repaint_screen (); }
void toggle_panels (void) { #ifdef HAVE_SUBSHELL_SUPPORT char *new_dir = NULL; char **new_dir_p; #endif /* HAVE_SUBSHELL_SUPPORT */ channels_down (); disable_mouse (); if (clear_before_exec) clr_scr (); if (alternate_plus_minus) numeric_keypad_mode (); #ifndef HAVE_SLANG /* With slang we don't want any of this, since there * is no mc_raw_mode supported */ reset_shell_mode (); noecho (); #endif /* !HAVE_SLANG */ keypad (stdscr, FALSE); endwin (); do_exit_ca_mode (); mc_raw_mode (); if (console_flag) handle_console (CONSOLE_RESTORE); #ifdef HAVE_SUBSHELL_SUPPORT if (use_subshell) { new_dir_p = vfs_current_is_local ()? &new_dir : NULL; if (invoke_subshell (NULL, VISIBLY, new_dir_p)) quiet_quit_cmd (); /* User did `exit' or `logout': quit MC quietly */ } else #endif /* HAVE_SUBSHELL_SUPPORT */ { if (output_starts_shell) { fprintf (stderr, _("Type `exit' to return to the Midnight Commander")); fprintf (stderr, "\n\r\n\r"); my_system (EXECUTE_INTERNAL, shell, NULL); } else get_key_code (0); } if (console_flag) handle_console (CONSOLE_SAVE); do_enter_ca_mode (); reset_prog_mode (); keypad (stdscr, TRUE); /* Prevent screen flash when user did 'exit' or 'logout' within subshell */ if (quit) return; enable_mouse (); channels_up (); if (alternate_plus_minus) application_keypad_mode (); #ifdef HAVE_SUBSHELL_SUPPORT if (use_subshell) { load_prompt (0, 0); if (new_dir) do_possible_cd (new_dir); if (console_flag && output_lines) show_console_contents (output_start_y, LINES - keybar_visible - output_lines - 1, LINES - keybar_visible - 1); } #endif /* HAVE_SUBSHELL_SUPPORT */ update_panels (UP_OPTIMIZE, UP_KEEPSEL); update_xterm_title_path (); do_refresh (); }