mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 10:04:32 +03:00
mcviewer: support file history.
This commit is contained in:
parent
0f02d49b0d
commit
f0c9e50f80
@ -405,6 +405,7 @@ FilePrev = ctrl-b
|
||||
SelectCodepage = alt-e
|
||||
Shell = ctrl-o
|
||||
Ruler = alt-r
|
||||
History = alt-shift-e
|
||||
|
||||
[viewer:hex]
|
||||
Help = f1
|
||||
@ -433,6 +434,7 @@ PageDown = pgdn; ctrl-v
|
||||
PageUp = pgup; alt-v
|
||||
Top = ctrl-home; ctrl-pgup; a1; alt-lt; g
|
||||
Bottom = ctrl-end; ctrl-pgdn; c1; alt-gt; shift-g
|
||||
History = alt-shift-e
|
||||
|
||||
[diffviewer]
|
||||
ShowSymbols = alt-s; s
|
||||
|
@ -407,6 +407,7 @@ FilePrev = ctrl-b
|
||||
SelectCodepage = alt-e
|
||||
Shell = ctrl-o
|
||||
Ruler = alt-r
|
||||
History = alt-shift-e
|
||||
|
||||
[viewer:hex]
|
||||
Help = f1
|
||||
@ -435,6 +436,7 @@ PageDown = pgdn; ctrl-v
|
||||
PageUp = pgup; alt-v
|
||||
Top = ctrl-home; ctrl-pgup; a1; alt-lt; g
|
||||
Bottom = ctrl-end; ctrl-pgdn; c1; alt-gt; shift-g
|
||||
History = alt-shift-e
|
||||
|
||||
[diffviewer]
|
||||
ShowSymbols = alt-s; s
|
||||
|
@ -490,6 +490,7 @@ static const global_keymap_ini_t default_viewer_keymap[] = {
|
||||
{"SearchForwardContinue", "ctrl-s"},
|
||||
{"SearchBackwardContinue", "ctrl-r"},
|
||||
{"SearchOppositeContinue", "shift-n"},
|
||||
{"History", "alt-shift-e"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@ -525,6 +526,7 @@ static const global_keymap_ini_t default_viewer_hex_keymap[] = {
|
||||
{"SearchForwardContinue", "ctrl-s"},
|
||||
{"SearchBackwardContinue", "ctrl-r"},
|
||||
{"SearchOppositeContinue", "shift-n"},
|
||||
{"History", "alt-shift-e"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
@ -65,6 +65,7 @@
|
||||
#include "src/filemanager/ext.h" /* regex_command_for() */
|
||||
|
||||
#include "src/history.h"
|
||||
#include "src/file_history.h" /* show_file_history() */
|
||||
#include "src/execute.h"
|
||||
#include "src/keybind-defaults.h"
|
||||
|
||||
@ -381,6 +382,30 @@ mcview_load_next_prev (WView * view, int direction)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
mcview_load_file_from_history (WView * view)
|
||||
{
|
||||
char *filename;
|
||||
int action;
|
||||
|
||||
filename = show_file_history (CONST_WIDGET (view), &action);
|
||||
|
||||
if (filename != NULL && (action == CK_View || action == CK_Enter))
|
||||
{
|
||||
mcview_done (view);
|
||||
mcview_init (view);
|
||||
|
||||
mcview_load (view, NULL, filename, 0, 0, 0);
|
||||
|
||||
view->dpy_bbar_dirty = FALSE; /* FIXME */
|
||||
view->dirty++;
|
||||
}
|
||||
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static cb_ret_t
|
||||
mcview_execute_cmd (WView * view, long command)
|
||||
{
|
||||
@ -538,6 +563,9 @@ mcview_execute_cmd (WView * view, long command)
|
||||
if (!mcview_is_in_panel (view))
|
||||
mcview_load_next_prev (view, command == CK_FileNext ? 1 : -1);
|
||||
break;
|
||||
case CK_History:
|
||||
mcview_load_file_from_history (view);
|
||||
break;
|
||||
case CK_Quit:
|
||||
if (!mcview_is_in_panel (view))
|
||||
dlg_stop (WIDGET (view)->owner);
|
||||
|
Loading…
Reference in New Issue
Block a user