mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Fix mode switch after CK_FileNext/CK_FilePrev.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
4d0f17e79a
commit
d70f6b5b63
@ -356,8 +356,6 @@ exec_extension_view (void *target, char *cmd, const vfs_path_t * filename_vpath,
|
|||||||
int def_hex_mode = mcview_default_hex_mode, changed_hex_mode = 0;
|
int def_hex_mode = mcview_default_hex_mode, changed_hex_mode = 0;
|
||||||
int def_nroff_flag = mcview_default_nroff_flag, changed_nroff_flag = 0;
|
int def_nroff_flag = mcview_default_nroff_flag, changed_nroff_flag = 0;
|
||||||
|
|
||||||
(void) target;
|
|
||||||
|
|
||||||
mcview_altered_hex_mode = 0;
|
mcview_altered_hex_mode = 0;
|
||||||
mcview_altered_nroff_flag = 0;
|
mcview_altered_nroff_flag = 0;
|
||||||
if (def_hex_mode != mcview_default_hex_mode)
|
if (def_hex_mode != mcview_default_hex_mode)
|
||||||
@ -365,7 +363,16 @@ exec_extension_view (void *target, char *cmd, const vfs_path_t * filename_vpath,
|
|||||||
if (def_nroff_flag != mcview_default_nroff_flag)
|
if (def_nroff_flag != mcview_default_nroff_flag)
|
||||||
changed_nroff_flag = 1;
|
changed_nroff_flag = 1;
|
||||||
|
|
||||||
mcview_viewer (cmd, filename_vpath, start_line);
|
if (target == NULL)
|
||||||
|
mcview_viewer (cmd, filename_vpath, start_line);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *file_name;
|
||||||
|
|
||||||
|
file_name = vfs_path_to_str (filename_vpath);
|
||||||
|
mcview_load ((mcview_t *) target, cmd, file_name, start_line);
|
||||||
|
g_free (file_name);
|
||||||
|
}
|
||||||
|
|
||||||
if (changed_hex_mode && !mcview_altered_hex_mode)
|
if (changed_hex_mode && !mcview_altered_hex_mode)
|
||||||
mcview_default_hex_mode = def_hex_mode;
|
mcview_default_hex_mode = def_hex_mode;
|
||||||
|
@ -63,6 +63,7 @@
|
|||||||
#include "src/filemanager/layout.h"
|
#include "src/filemanager/layout.h"
|
||||||
#include "src/filemanager/cmd.h"
|
#include "src/filemanager/cmd.h"
|
||||||
#include "src/filemanager/midnight.h" /* current_panel */
|
#include "src/filemanager/midnight.h" /* current_panel */
|
||||||
|
#include "src/filemanager/ext.h" /* regex_command_for() */
|
||||||
|
|
||||||
#include "src/history.h"
|
#include "src/history.h"
|
||||||
#include "src/execute.h"
|
#include "src/execute.h"
|
||||||
@ -78,9 +79,23 @@
|
|||||||
|
|
||||||
/*** file scope variables ************************************************************************/
|
/*** file scope variables ************************************************************************/
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
/*** file scope functions ************************************************************************/
|
/*** file scope functions ************************************************************************/
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
static void
|
||||||
|
mcview_remove_ext_script (mcview_t * view)
|
||||||
|
{
|
||||||
|
if (view->ext_script != NULL)
|
||||||
|
{
|
||||||
|
mc_unlink (view->ext_script);
|
||||||
|
vfs_path_free (view->ext_script);
|
||||||
|
view->ext_script = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* Both views */
|
/* Both views */
|
||||||
static void
|
static void
|
||||||
mcview_search (mcview_t * view)
|
mcview_search (mcview_t * view)
|
||||||
@ -320,7 +335,7 @@ mcview_load_next_prev (mcview_t * view, int direction)
|
|||||||
dir_list *dir;
|
dir_list *dir;
|
||||||
int *dir_count, *dir_idx;
|
int *dir_count, *dir_idx;
|
||||||
vfs_path_t *vfile;
|
vfs_path_t *vfile;
|
||||||
char *file;
|
vfs_path_t *ext_script = NULL;
|
||||||
|
|
||||||
mcview_load_next_prev_init (view);
|
mcview_load_next_prev_init (view);
|
||||||
mcview_scan_for_file (view, direction);
|
mcview_scan_for_file (view, direction);
|
||||||
@ -333,15 +348,22 @@ mcview_load_next_prev (mcview_t * view, int direction)
|
|||||||
view->dir_count = NULL;
|
view->dir_count = NULL;
|
||||||
view->dir_idx = NULL;
|
view->dir_idx = NULL;
|
||||||
vfile = vfs_path_append_new (view->workdir_vpath, dir->list[*dir_idx].fname, (char *) NULL);
|
vfile = vfs_path_append_new (view->workdir_vpath, dir->list[*dir_idx].fname, (char *) NULL);
|
||||||
file = vfs_path_to_str (vfile);
|
|
||||||
vfs_path_free (vfile);
|
|
||||||
mcview_done (view);
|
mcview_done (view);
|
||||||
|
mcview_remove_ext_script (view);
|
||||||
mcview_init (view);
|
mcview_init (view);
|
||||||
mcview_load (view, NULL, file, 0);
|
if (regex_command_for (view, vfile, "View", &ext_script) == 0)
|
||||||
g_free (file);
|
{
|
||||||
|
char *file;
|
||||||
|
|
||||||
|
file = vfs_path_to_str (vfile);
|
||||||
|
mcview_load (view, NULL, file, 0);
|
||||||
|
g_free (file);
|
||||||
|
}
|
||||||
|
vfs_path_free (vfile);
|
||||||
view->dir = dir;
|
view->dir = dir;
|
||||||
view->dir_count = dir_count;
|
view->dir_count = dir_count;
|
||||||
view->dir_idx = dir_idx;
|
view->dir_idx = dir_idx;
|
||||||
|
view->ext_script = ext_script;
|
||||||
|
|
||||||
view->dpy_bbar_dirty = FALSE; /* FIXME */
|
view->dpy_bbar_dirty = FALSE; /* FIXME */
|
||||||
view->dirty++;
|
view->dirty++;
|
||||||
@ -622,6 +644,7 @@ mcview_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *
|
|||||||
mcview_ok_to_quit (view);
|
mcview_ok_to_quit (view);
|
||||||
}
|
}
|
||||||
mcview_done (view);
|
mcview_done (view);
|
||||||
|
mcview_remove_ext_script (view);
|
||||||
return MSG_HANDLED;
|
return MSG_HANDLED;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -188,6 +188,7 @@ struct mcview_struct
|
|||||||
* Pointer is used here as reference to WPanel::count */
|
* Pointer is used here as reference to WPanel::count */
|
||||||
int *dir_idx; /* Index of current file in dir structure.
|
int *dir_idx; /* Index of current file in dir structure.
|
||||||
* Pointer is used here as reference to WPanel::count */
|
* Pointer is used here as reference to WPanel::count */
|
||||||
|
vfs_path_t *ext_script; /* Temporary script file created by regex_command_for() */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct mcview_nroff_struct
|
typedef struct mcview_nroff_struct
|
||||||
|
Loading…
Reference in New Issue
Block a user