(toggle_panels): join with view_other_cmd and rename to toggle_subshell.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2019-08-10 11:57:31 +03:00
parent 02f49a8f6d
commit 247af01a8e
9 changed files with 24 additions and 30 deletions

View File

@ -253,7 +253,7 @@ typedef struct
#endif /* !ENABLE_SUBSHELL */
/* This flag is set by xterm detection routine in function main() */
/* It is used by function view_other_cmd() */
/* It is used by function toggle_subshell() */
gboolean xterm_flag;
/* disable x11 support */

View File

@ -50,10 +50,11 @@
#endif
#include "lib/event.h" /* mc_event_raise() */
#include "src/filemanager/cmd.h" /* edit_file_at_line(), view_other_cmd() */
#include "src/filemanager/cmd.h" /* edit_file_at_line() */
#include "src/filemanager/panel.h"
#include "src/filemanager/layout.h" /* Needed for get_current_index and get_other_panel */
#include "src/execute.h" /* toggle_subshell() */
#include "src/keybind-defaults.h"
#include "src/setup.h"
#include "src/history.h"
@ -3253,7 +3254,7 @@ dview_execute_cmd (WDiff * dview, long command)
dview->skip_cols = 0;
break;
case CK_Shell:
view_other_cmd ();
toggle_subshell ();
break;
case CK_Quit:
dview->view_quit = TRUE;

View File

@ -57,7 +57,8 @@
#include "src/keybind-defaults.h" /* keybind_lookup_keymap_command() */
#include "src/setup.h" /* home_dir */
#include "src/filemanager/cmd.h" /* view_other_cmd(), save_setup_cmd() */
#include "src/execute.h" /* toggle_subshell() */
#include "src/filemanager/cmd.h" /* save_setup_cmd() */
#include "src/learn.h" /* learn_keys() */
#include "src/args.h" /* mcedit_arg_t */
@ -467,7 +468,7 @@ edit_dialog_command_execute (WDialog * h, long command)
edit_refresh_cmd ();
break;
case CK_Shell:
view_other_cmd ();
toggle_subshell ();
break;
case CK_LearnKeys:
learn_keys ();

View File

@ -446,14 +446,26 @@ shell_execute (const char *command, int flags)
/* --------------------------------------------------------------------------------------------- */
void
toggle_panels (void)
toggle_subshell (void)
{
static gboolean message_flag = TRUE;
#ifdef ENABLE_SUBSHELL
vfs_path_t *new_dir_vpath = NULL;
#endif /* ENABLE_SUBSHELL */
SIG_ATOMIC_VOLATILE_T was_sigwinch = 0;
if (!(mc_global.tty.xterm_flag || mc_global.tty.console_flag != '\0'
|| mc_global.tty.use_subshell || output_starts_shell))
{
if (message_flag)
message (D_ERROR, MSG_ERROR,
_("Not an xterm or Linux console;\nthe panels cannot be toggled."));
message_flag = FALSE;
return;
}
channels_down ();
disable_mouse ();
disable_bracketed_paste ();

View File

@ -32,7 +32,7 @@ extern int pause_after_run;
void shell_execute (const char *command, int flags);
/* Handle toggling panels by Ctrl-O */
void toggle_panels (void);
void toggle_subshell (void);
/* Handle toggling panels by Ctrl-Z */
gboolean execute_suspend (const gchar * event_group_name, const gchar * event_name,

View File

@ -1204,25 +1204,6 @@ swap_cmd (void)
/* --------------------------------------------------------------------------------------------- */
void
view_other_cmd (void)
{
static gboolean message_flag = TRUE;
if (mc_global.tty.xterm_flag || mc_global.tty.console_flag != '\0'
|| mc_global.tty.use_subshell || output_starts_shell)
toggle_panels ();
else
{
if (message_flag)
message (D_ERROR, MSG_ERROR,
_("Not an xterm or Linux console;\nthe panels cannot be toggled."));
message_flag = FALSE;
}
}
/* --------------------------------------------------------------------------------------------- */
void
link_cmd (link_type_t link_type)
{

View File

@ -80,7 +80,6 @@ void panel_tree_cmd (void);
void link_cmd (link_type_t link_type);
void edit_symlink_cmd (void);
void swap_cmd (void);
void view_other_cmd (void);
void quick_cd_cmd (void);
void save_setup_cmd (void);
void user_file_menu_cmd (void);

View File

@ -58,6 +58,7 @@
#ifdef ENABLE_SUBSHELL
#include "src/subshell/subshell.h"
#endif
#include "src/execute.h" /* toggle_subshell */
#include "src/setup.h" /* variables */
#include "src/learn.h" /* learn_keys() */
#include "src/keybind-defaults.h"
@ -1367,7 +1368,7 @@ midnight_execute_cmd (Widget * sender, long command)
res = send_message (current_panel, midnight_dlg, MSG_ACTION, command, NULL);
break;
case CK_Shell:
view_other_cmd ();
toggle_subshell ();
break;
case CK_DirSize:
smart_dirsize_cmd ();

View File

@ -61,7 +61,6 @@
#include "lib/mcconfig.h" /* mc_config_history_get() */
#include "src/filemanager/layout.h"
#include "src/filemanager/cmd.h"
#include "src/filemanager/midnight.h" /* current_panel */
#include "src/filemanager/ext.h" /* regex_command_for() */
@ -538,7 +537,7 @@ mcview_execute_cmd (WView * view, long command)
mcview_moveto_bottom (view);
break;
case CK_Shell:
view_other_cmd ();
toggle_subshell ();
break;
case CK_Ruler:
mcview_display_toggle_ruler (view);