mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 04:22:34 +03:00
Ticket #120 (View diff files)
added src/diffviewer/ydiff.[ch] into project tree added entry 'View diff files' into 'Command' menu added 'diffviewer' color pairs fixed Makefile and configure.am added new binding CmdDiffView into '[main]' section Big thanx to 'Daniel Borca <dborca@yahoo.com>' for ydiff Signed-off-by: Ilia Maslakov <il.smind@gmail.com> Added diffviewer own library Signed-off-by: Slava Zanko <slavazanko@gmail.com> Fixed CFLAGS for diffviewer. Signed-off-by: Andrew Borodin <aborodin@vmail.ru> changed skins, added section [diffviewer] added= changedline= changednew= changed= removed= folder= error= Signed-off-by: Ilia Maslakov <il.smind@gmail.com> Reimplementation of hardcoded shortcuts to keybindings. Signed-off-by: Ilia Maslakov <il.smind@gmail.com> Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
5c5b35ae47
commit
329ef3846a
18
configure.ac
18
configure.ac
@ -482,6 +482,21 @@ else
|
||||
edit_msg="no"
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Diff viewer support.
|
||||
dnl
|
||||
AC_ARG_WITH(diff_viewer,
|
||||
[ --with-diff-viewer Compile with diff viewer [[yes]]])
|
||||
|
||||
if test x$with_diff_viewer != xno; then
|
||||
AC_DEFINE(USE_DIFF_VIEW, 1, [Define to enable diff viewer])
|
||||
use_diff=yes
|
||||
diff_msg="yes"
|
||||
AC_MSG_NOTICE([using diff viewer])
|
||||
else
|
||||
diff_msg="no"
|
||||
fi
|
||||
|
||||
|
||||
dnl Check if the OS is supported by the console saver.
|
||||
cons_saver=""
|
||||
@ -555,6 +570,7 @@ fi
|
||||
AM_CONDITIONAL(USE_MAINTAINER_MODE, [test x"$USE_MAINTAINER_MODE" = xyes])
|
||||
AM_CONDITIONAL(USE_SCREEN_SLANG, [test x"$with_screen" = xslang])
|
||||
AM_CONDITIONAL(USE_EDIT, [test -n "$use_edit"])
|
||||
AM_CONDITIONAL(USE_DIFF, [test -n "$use_diff"])
|
||||
AM_CONDITIONAL(ENABLE_VFS_NET, [test x"$use_net_code" = xtrue])
|
||||
AM_CONDITIONAL(USE_SAMBA_FS, [test -n "$use_smbfs"])
|
||||
AM_CONDITIONAL(ENABLE_MCSERVER, [test x"$enable_mcserver" = "xyes"])
|
||||
@ -582,6 +598,7 @@ src/Makefile
|
||||
src/consaver/Makefile
|
||||
src/editor/Makefile
|
||||
src/viewer/Makefile
|
||||
src/diffviewer/Makefile
|
||||
|
||||
lib/Makefile
|
||||
lib/filehighlight/Makefile
|
||||
@ -662,6 +679,7 @@ Configuration:
|
||||
X11 events support: ${textmode_x11_support}
|
||||
With subshell support: ${subshell}
|
||||
Internal editor: ${edit_msg}
|
||||
Diff viewer: ${diff_msg}
|
||||
Support for charset: ${charset_msg}
|
||||
Search type: ${SEARCH_TYPE}
|
||||
"
|
||||
|
13
lib/skin.h
13
lib/skin.h
@ -71,7 +71,18 @@
|
||||
#define BUTTONBAR_HOTKEY_COLOR mc_skin_color__cache[34]
|
||||
#define BUTTONBAR_BUTTON_COLOR mc_skin_color__cache[35]
|
||||
|
||||
#define MC_SKIN_COLOR_CACHE_COUNT 36
|
||||
/* Diff colors */
|
||||
#define DFF_ADD_COLOR mc_skin_color__cache[36]
|
||||
#define DFF_CHG_COLOR mc_skin_color__cache[37]
|
||||
#define DFF_CHH_COLOR mc_skin_color__cache[38]
|
||||
#define DFF_CHD_COLOR mc_skin_color__cache[39]
|
||||
#define DFF_DEL_COLOR mc_skin_color__cache[40]
|
||||
#define DFF_FOLDER_COLOR mc_skin_color__cache[41]
|
||||
#define DFF_ERROR_COLOR mc_skin_color__cache[42]
|
||||
|
||||
|
||||
|
||||
#define MC_SKIN_COLOR_CACHE_COUNT 43
|
||||
|
||||
|
||||
/*** enums ***************************************************************************************/
|
||||
|
@ -240,6 +240,14 @@ mc_skin_color_cache_init (void)
|
||||
BOOK_MARK_FOUND_COLOR = mc_skin_color_get ("editor", "bookmarkfound");
|
||||
BUTTONBAR_HOTKEY_COLOR = mc_skin_color_get ("buttonbar", "hotkey");
|
||||
BUTTONBAR_BUTTON_COLOR = mc_skin_color_get ("buttonbar", "button");
|
||||
|
||||
DFF_ADD_COLOR = mc_skin_color_get ("diffviewer", "added");
|
||||
DFF_CHG_COLOR = mc_skin_color_get ("diffviewer", "changedline");
|
||||
DFF_CHH_COLOR = mc_skin_color_get ("diffviewer", "changednew");
|
||||
DFF_CHD_COLOR = mc_skin_color_get ("diffviewer", "changed");
|
||||
DFF_DEL_COLOR = mc_skin_color_get ("diffviewer", "removed");
|
||||
DFF_FOLDER_COLOR = mc_skin_color_get ("diffviewer", "folder");
|
||||
DFF_ERROR_COLOR = mc_skin_color_get ("diffviewer", "error");
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -255,6 +255,7 @@ CmdCopyCurrentPathname = p
|
||||
CmdCopyOtherPathname = ctrl-p
|
||||
CmdCopyCurrentTagged = t
|
||||
CmdCopyOtherTagged = ctrl-t
|
||||
CmdDiffView = ctrl-y
|
||||
|
||||
[panel]
|
||||
PanelStartSearch = ctrl-s; alt-s
|
||||
@ -357,3 +358,39 @@ HelpNextLink = tab
|
||||
HelpPrevLink = alt-tab
|
||||
HelpNextNode = n
|
||||
HelpPrevNode = p
|
||||
|
||||
[diffviewer]
|
||||
DiffDisplaySymbols = alt-s; s
|
||||
DiffDisplayNumbers = alt-n; l
|
||||
DiffFull = f
|
||||
DiffEqual = equal
|
||||
DiffSplitMore = gt
|
||||
DiffSplitLess = lt
|
||||
DiffSetTab2 = 2
|
||||
DiffSetTab3 = 3
|
||||
DiffSetTab4 = 4
|
||||
DiffSetTab8 = 8
|
||||
DiffSwapPanel = ctrl-u
|
||||
DiffRedo = ctrl-r
|
||||
DiffNextHunk = n; enter; space
|
||||
DiffPrevHunk = p; backspace
|
||||
DiffGoto = g; shift-g
|
||||
DiffEditCurrent = f4
|
||||
DiffEditOther = f14
|
||||
DiffMergeCurrentHunk = f5
|
||||
DiffSearch = f7
|
||||
DiffContinueSearch = f17
|
||||
DiffBOF = ctrl-home
|
||||
DiffEOF = ctrl-end
|
||||
DiffDown = down
|
||||
DiffUp = up
|
||||
DiffQuickLeft = ctrl-left
|
||||
DiffQuickRight = ctrl-right
|
||||
DiffLeft = left
|
||||
DiffRight = right
|
||||
DiffPageDown = pgdn
|
||||
DiffPageUp = pgup
|
||||
DiffHome = home
|
||||
DiffEnd = end
|
||||
DiffQuit = q; shift-q; ctrl-g; esc
|
||||
ShowCommandLine = ctrl-o
|
||||
|
@ -259,6 +259,7 @@ CmdCopyCurrentPathname = p
|
||||
CmdCopyOtherPathname = ctrl-p
|
||||
CmdCopyCurrentTagged = t
|
||||
CmdCopyOtherTagged = ctrl-t
|
||||
CmdDiffView = ctrl-y
|
||||
|
||||
[panel]
|
||||
PanelStartSearch = ctrl-s; alt-s
|
||||
@ -361,3 +362,40 @@ HelpNextLink = tab
|
||||
HelpPrevLink = alt-tab
|
||||
HelpNextNode = n
|
||||
HelpPrevNode = p
|
||||
|
||||
[diffviewer]
|
||||
DiffDisplaySymbols = alt-s; s
|
||||
DiffDisplayNumbers = alt-n; l
|
||||
DiffFull = f
|
||||
DiffEqual = equal
|
||||
DiffSplitMore = gt
|
||||
DiffSplitLess = lt
|
||||
DiffSetTab2 = 2
|
||||
DiffSetTab3 = 3
|
||||
DiffSetTab4 = 4
|
||||
DiffSetTab8 = 8
|
||||
DiffSwapPanel = ctrl-u
|
||||
DiffRedo = ctrl-r
|
||||
DiffNextHunk = n; enter; space
|
||||
DiffPrevHunk = p; backspace
|
||||
DiffGoto = g; shift-g
|
||||
DiffSave = f2
|
||||
DiffEditCurrent = f4
|
||||
DiffEditOther = f14
|
||||
DiffMergeCurrentHunk = f5
|
||||
DiffSearch = f7
|
||||
DiffContinueSearch = f17
|
||||
DiffBOF = ctrl-home
|
||||
DiffEOF = ctrl-end
|
||||
DiffDown = down
|
||||
DiffUp = up
|
||||
DiffQuickLeft = ctrl-left
|
||||
DiffQuickRight = ctrl-right
|
||||
DiffLeft = left
|
||||
DiffRight = right
|
||||
DiffPageDown = pgdn
|
||||
DiffPageUp = pgup
|
||||
DiffHome = home
|
||||
DiffEnd = end
|
||||
DiffQuit = q; shift-q; ctrl-g; esc
|
||||
ShowCommandLine = ctrl-o
|
||||
|
@ -87,6 +87,15 @@
|
||||
[viewer]
|
||||
viewunderline=brightred;black
|
||||
|
||||
[diffviewer]
|
||||
added=white;green
|
||||
changedline=blue;cyan
|
||||
changednew=red;cyan
|
||||
changed=white;cyan
|
||||
removed=white;red
|
||||
folder=blue;black
|
||||
error=red;white
|
||||
|
||||
[buttonbar]
|
||||
hotkey=red;white
|
||||
button=black;white
|
||||
|
@ -91,6 +91,15 @@
|
||||
[viewer]
|
||||
viewunderline=brightred;blue
|
||||
|
||||
[diffviewer]
|
||||
added=white;green
|
||||
changedline=blue;cyan
|
||||
changednew=red;cyan
|
||||
changed=white;cyan
|
||||
removed=white;red
|
||||
folder=blue;black
|
||||
error=red;white
|
||||
|
||||
[widget-common]
|
||||
sort-sign-up = '
|
||||
sort-sign-down = ,
|
||||
|
@ -87,6 +87,15 @@
|
||||
[viewer]
|
||||
viewunderline=brightred;blue
|
||||
|
||||
[diffviewer]
|
||||
added=white;green
|
||||
changedline=blue;cyan
|
||||
changednew=red;cyan
|
||||
changed=white;cyan
|
||||
removed=white;red
|
||||
folder=blue;black
|
||||
error=red;white
|
||||
|
||||
[widget-common]
|
||||
sort-sign-up = '
|
||||
sort-sign-down = ,
|
||||
|
@ -93,6 +93,15 @@
|
||||
[viewer]
|
||||
viewunderline=brightred;blue
|
||||
|
||||
[diffviewer]
|
||||
added=white;green
|
||||
changedline=blue;cyan
|
||||
changednew=red;cyan
|
||||
changed=white;cyan
|
||||
removed=white;red
|
||||
folder=blue;black
|
||||
error=red;white
|
||||
|
||||
[widget-common]
|
||||
sort-sign-up = ↓
|
||||
sort-sign-down = ↑
|
||||
|
@ -87,6 +87,15 @@
|
||||
[viewer]
|
||||
viewunderline=brightgreen;black
|
||||
|
||||
[diffviewer]
|
||||
added=white;green
|
||||
changedline=blue;cyan
|
||||
changednew=red;cyan
|
||||
changed=white;cyan
|
||||
removed=white;red
|
||||
folder=blue;black
|
||||
error=red;white
|
||||
|
||||
[buttonbar]
|
||||
hotkey=lightgray;black
|
||||
button=white;blue
|
||||
|
@ -4,6 +4,9 @@ if USE_EDIT
|
||||
SUBDIRS += editor
|
||||
endif
|
||||
|
||||
if USE_DIFF
|
||||
SUBDIRS += diffviewer
|
||||
endif
|
||||
|
||||
AM_CPPFLAGS = -DDATADIR=\""$(pkgdatadir)/"\" \
|
||||
-DLOCALEDIR=\""$(localedir)"\" \
|
||||
@ -36,16 +39,22 @@ if USE_EDIT
|
||||
EDITLIB = editor/libedit.la
|
||||
endif
|
||||
|
||||
if USE_DIFF
|
||||
DIFFLIB = diffviewer/libdiffviewer.la
|
||||
endif
|
||||
|
||||
SRC_charset = charsets.c charsets.h selcodepage.c selcodepage.h
|
||||
|
||||
if CHARSET
|
||||
SRC_USE_charset=$(SRC_charset)
|
||||
endif
|
||||
|
||||
|
||||
mc_LDADD = \
|
||||
../lib/libmc.la \
|
||||
$(EDITLIB) \
|
||||
viewer/libmcviewer.la \
|
||||
$(EDITLIB) \
|
||||
$(DIFFLIB) \
|
||||
$(INTLLIBS) $(MCLIBS) $(SLANGLIB) $(LIBICONV) \
|
||||
$(GLIB_LIBS) $(PCRE_LIBS)
|
||||
|
||||
|
@ -946,6 +946,14 @@ compare_dirs_cmd (void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_DIFF_VIEW
|
||||
void
|
||||
diff_view_cmd (void)
|
||||
{
|
||||
view_diff_cmd (NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
history_cmd (void)
|
||||
{
|
||||
|
@ -43,6 +43,7 @@ void edit_mc_menu_cmd (void);
|
||||
void edit_fhl_cmd (void);
|
||||
void quick_chdir_cmd (void);
|
||||
void compare_dirs_cmd (void);
|
||||
void diff_view_cmd (void);
|
||||
void history_cmd (void);
|
||||
void tree_cmd (void);
|
||||
void link_cmd (void);
|
||||
|
35
src/cmddef.h
35
src/cmddef.h
@ -367,6 +367,7 @@
|
||||
#define CK_HelpCmd 7072
|
||||
#define CK_MenuCmd 7073
|
||||
#define CK_TogglePanelsSplit 7074
|
||||
#define CK_DiffViewCmd 7075
|
||||
|
||||
/* panels */
|
||||
#define CK_PanelChdirOtherPanel 8001
|
||||
@ -409,6 +410,40 @@
|
||||
#define CK_PanelSortOrderBySize 8038
|
||||
#define CK_PanelSortOrderByMTime 8039
|
||||
|
||||
/* diff viewer */
|
||||
#define CK_DiffDisplaySymbols 9001
|
||||
#define CK_DiffDisplayNumbers 9002
|
||||
#define CK_DiffFull 9003
|
||||
#define CK_DiffEqual 9004
|
||||
#define CK_DiffSplitMore 9005
|
||||
#define CK_DiffSplitLess 9006
|
||||
#define CK_DiffShowDiff 9008
|
||||
#define CK_DiffSetTab2 9009
|
||||
#define CK_DiffSetTab3 9010
|
||||
#define CK_DiffSetTab4 9011
|
||||
#define CK_DiffSetTab8 9012
|
||||
#define CK_DiffSwapPanel 9013
|
||||
#define CK_DiffRedo 9014
|
||||
#define CK_DiffNextHunk 9015
|
||||
#define CK_DiffPrevHunk 9016
|
||||
#define CK_DiffGoto 9017
|
||||
#define CK_DiffEditCurrent 9018
|
||||
#define CK_DiffEditOther 9019
|
||||
#define CK_DiffSearch 9020
|
||||
#define CK_DiffEOF 9021
|
||||
#define CK_DiffBOF 9022
|
||||
#define CK_DiffDown 9023
|
||||
#define CK_DiffUp 9024
|
||||
#define CK_DiffLeft 9025
|
||||
#define CK_DiffRight 9026
|
||||
#define CK_DiffQuickLeft 9027
|
||||
#define CK_DiffQuickRight 9028
|
||||
#define CK_DiffPageDown 9029
|
||||
#define CK_DiffPageUp 9030
|
||||
#define CK_DiffHome 9031
|
||||
#define CK_DiffEnd 9032
|
||||
#define CK_DiffQuit 9033
|
||||
|
||||
/*
|
||||
Process a block through a shell command: CK_Pipe_Block(i) executes shell_cmd[i].
|
||||
shell_cmd[i] must process the file ~/cooledit.block and output ~/cooledit.block
|
||||
|
9
src/diffviewer/Makefile.am
Normal file
9
src/diffviewer/Makefile.am
Normal file
@ -0,0 +1,9 @@
|
||||
noinst_LTLIBRARIES = libdiffviewer.la
|
||||
|
||||
libdiffviewer_la_SOURCES = \
|
||||
ydiff.c \
|
||||
ydiff.h
|
||||
|
||||
libdiffviewer_la_CFLAGS = -I$(top_srcdir) \
|
||||
$(GLIB_CFLAGS) $(PCRE_CFLAGS) \
|
||||
-DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\"
|
2974
src/diffviewer/ydiff.c
Normal file
2974
src/diffviewer/ydiff.c
Normal file
File diff suppressed because it is too large
Load Diff
6
src/diffviewer/ydiff.h
Normal file
6
src/diffviewer/ydiff.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef MC_YDIFF_H
|
||||
#define MC_YDIFF_H
|
||||
|
||||
int diff_view (const char *file1, const char *file2, const char *label1, const char *label2);
|
||||
|
||||
#endif
|
@ -41,4 +41,6 @@
|
||||
|
||||
#define MC_HISTORY_SHARED_SEARCH "mc.shared.search"
|
||||
|
||||
#define MC_HISTORY_YDIFF_GOTO_LINE "mc.ydiff.goto-line"
|
||||
|
||||
#endif
|
||||
|
@ -367,6 +367,9 @@ static name_keymap_t command_names[] = {
|
||||
{ "CmdCopyOtherTagged", CK_CopyOtherTagged },
|
||||
{ "CmdToggleShowHidden", CK_ToggleShowHidden },
|
||||
{ "CmdTogglePanelsSplit", CK_TogglePanelsSplit },
|
||||
#ifdef USE_DIFF_VIEW
|
||||
{ "CmdDiffView", CK_DiffViewCmd},
|
||||
#endif
|
||||
|
||||
/* panel */
|
||||
{ "PanelChdirOtherPanel", CK_PanelChdirOtherPanel },
|
||||
@ -444,6 +447,39 @@ static name_keymap_t command_names[] = {
|
||||
{ "ShowCommandLine", CK_ShowCommandLine },
|
||||
{ "SelectCodepage", CK_SelectCodepage },
|
||||
|
||||
|
||||
/* diff viewer */
|
||||
{ "DiffDisplaySymbols", CK_DiffDisplaySymbols},
|
||||
{ "DiffDisplayNumbers", CK_DiffDisplayNumbers},
|
||||
{ "DiffFull", CK_DiffFull},
|
||||
{ "DiffEqual", CK_DiffEqual},
|
||||
{ "DiffSplitMore", CK_DiffSplitMore},
|
||||
{ "DiffSplitLess", CK_DiffSplitLess},
|
||||
{ "DiffShowDiff", CK_DiffShowDiff},
|
||||
{ "DiffSetTab2", CK_DiffSetTab2},
|
||||
{ "DiffSetTab3", CK_DiffSetTab3},
|
||||
{ "DiffSetTab4", CK_DiffSetTab4},
|
||||
{ "DiffSetTab8", CK_DiffSetTab8},
|
||||
{ "DiffSwapPanel", CK_DiffSwapPanel},
|
||||
{ "DiffRedo", CK_DiffRedo},
|
||||
{ "DiffNextHunk", CK_DiffNextHunk},
|
||||
{ "DiffPrevHunk", CK_DiffPrevHunk},
|
||||
{ "DiffGoto", CK_DiffGoto},
|
||||
{ "DiffEditCurrent", CK_DiffEditCurrent},
|
||||
{ "DiffEditOther", CK_DiffEditOther},
|
||||
{ "DiffSearch", CK_DiffSearch},
|
||||
{ "DiffEOF", CK_DiffEOF},
|
||||
{ "DiffBOF", CK_DiffBOF},
|
||||
{ "DiffDown", CK_DiffDown},
|
||||
{ "DiffUp", CK_DiffUp},
|
||||
{ "DiffLeft", CK_DiffLeft},
|
||||
{ "DiffRight", CK_DiffRight},
|
||||
{ "DiffPageDown", CK_DiffPageDown},
|
||||
{ "DiffPageUp", CK_DiffPageUp},
|
||||
{ "DiffHome", CK_DiffHome},
|
||||
{ "DiffEnd", CK_DiffEnd},
|
||||
{ "DiffQuit", CK_DiffQuit},
|
||||
|
||||
{ NULL, CK_Ignore_Key }
|
||||
};
|
||||
|
||||
@ -909,6 +945,47 @@ const global_keymap_t default_input_keymap[] = {
|
||||
{ 0, CK_Ignore_Key, "" }
|
||||
};
|
||||
|
||||
/* diff viewer */
|
||||
const global_keymap_t default_diff_keymap[] = {
|
||||
|
||||
{ 's', CK_DiffDisplaySymbols, "s" },
|
||||
{ 'l', CK_DiffDisplayNumbers, "l" },
|
||||
{ 'f', CK_DiffFull, "f" },
|
||||
{ '=', CK_DiffEqual, "=" },
|
||||
{ '>', CK_DiffSplitMore, ">" },
|
||||
{ '<', CK_DiffSplitLess, "<" },
|
||||
{ '2', CK_DiffSetTab2, "2" },
|
||||
{ '3', CK_DiffSetTab3, "3" },
|
||||
{ '4', CK_DiffSetTab4, "4" },
|
||||
{ '8', CK_DiffSetTab8, "8" },
|
||||
{ XCTRL ('u'), CK_DiffSwapPanel, "C-u" },
|
||||
{ XCTRL ('r'), CK_DiffRedo, "C-r" },
|
||||
{ XCTRL ('o'), CK_ShowCommandLine, "C-o" },
|
||||
{ 'n', CK_DiffNextHunk, "n" },
|
||||
{ 'p', CK_DiffPrevHunk, "p" },
|
||||
{ 'g', CK_DiffGoto, "g" },
|
||||
{ 'G', CK_DiffGoto, "G" },
|
||||
{ KEY_F (4), CK_DiffEditCurrent, "F4" },
|
||||
{ KEY_F (14), CK_DiffEditOther, "S-F4" },
|
||||
{ KEY_F (17), CK_DiffSearch, "S-F7" },
|
||||
{ KEY_M_CTRL | KEY_HOME, CK_DiffBOF, "C-Home" },
|
||||
{ KEY_M_CTRL | KEY_END, CK_DiffEOF, "C-End" },
|
||||
{ KEY_DOWN, CK_DiffDown, "Down" },
|
||||
{ KEY_UP, CK_DiffUp, "Up" },
|
||||
{ KEY_M_CTRL | KEY_LEFT, CK_DiffQuickLeft, "C-Left" },
|
||||
{ KEY_M_CTRL | KEY_RIGHT, CK_DiffQuickRight, "C-Right" },
|
||||
{ KEY_LEFT, CK_DiffLeft, "Left" },
|
||||
{ KEY_RIGHT, CK_DiffRight, "Right" },
|
||||
{ KEY_NPAGE, CK_DiffPageDown, "Down" },
|
||||
{ KEY_PPAGE, CK_DiffPageUp, "Up" },
|
||||
{ KEY_HOME, CK_DiffHome, "Home" },
|
||||
{ KEY_END, CK_DiffEnd, "End" },
|
||||
{ 'q', CK_DiffQuit, "q" },
|
||||
{ 'Q', CK_DiffQuit, "Q" },
|
||||
{ XCTRL ('g'), CK_DiffQuit, "C-g" },
|
||||
{ ESC_CHAR, CK_DiffQuit, "Esc" },
|
||||
};
|
||||
|
||||
static int
|
||||
name_keymap_comparator (const void *p1, const void *p2)
|
||||
{
|
||||
|
@ -55,4 +55,9 @@ extern const global_keymap_t default_tree_keymap[];
|
||||
/* help.c */
|
||||
extern const global_keymap_t default_help_keymap[];
|
||||
|
||||
#ifdef USE_DIFF_VIEW
|
||||
/* yview.c */
|
||||
extern const global_keymap_t default_diff_keymap[];
|
||||
#endif
|
||||
|
||||
#endif /* MC_KEYBIND_H */
|
||||
|
18
src/main.c
18
src/main.c
@ -317,7 +317,9 @@ GArray *panel_keymap = NULL;
|
||||
GArray *input_keymap = NULL;
|
||||
GArray *tree_keymap = NULL;
|
||||
GArray *help_keymap = NULL;
|
||||
|
||||
#ifdef USE_DIFF_VIEW
|
||||
GArray *diff_keymap = NULL;
|
||||
#endif
|
||||
const global_keymap_t *main_map;
|
||||
const global_keymap_t *main_x_map;
|
||||
|
||||
@ -746,6 +748,9 @@ create_command_menu (void)
|
||||
entries = g_list_append (entries, menu_entry_create (_("S&wap panels"), CK_SwapCmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Switch &panels on/off"), CK_ShowCommandLine));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Compare directories"), CK_CompareDirsCmd));
|
||||
#ifdef USE_DIFF_VIEW
|
||||
entries = g_list_append (entries, menu_entry_create (_("&View diff files"), CK_DiffViewCmd));
|
||||
#endif
|
||||
entries = g_list_append (entries, menu_entry_create (_("E&xternal panelize"), CK_ExternalPanelize));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Show directory s&izes"), CK_SingleDirsizeCmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
@ -1153,6 +1158,11 @@ midnight_execute_cmd (Widget *sender, unsigned long command)
|
||||
case CK_CompareDirsCmd:
|
||||
compare_dirs_cmd ();
|
||||
break;
|
||||
#ifdef USE_DIFF_VIEW
|
||||
case CK_DiffViewCmd:
|
||||
diff_view_cmd ();
|
||||
break;
|
||||
#endif
|
||||
case CK_ConfigureBox:
|
||||
configure_box ();
|
||||
break;
|
||||
@ -1880,6 +1890,12 @@ do_nc (void)
|
||||
if (help_keymap && help_keymap->len > 0)
|
||||
help_map = (global_keymap_t *) help_keymap->data;
|
||||
|
||||
#ifdef USE_DIFF_VIEW
|
||||
diff_map = default_diff_keymap;
|
||||
if (diff_keymap && diff_keymap->len > 0)
|
||||
diff_map = (global_keymap_t *) diff_keymap->data;
|
||||
#endif
|
||||
|
||||
/* Check if we were invoked as an editor or file viewer */
|
||||
if ((view_one_file != NULL) || (edit_one_file != NULL))
|
||||
mc_maybe_editor_or_viewer ();
|
||||
|
@ -99,12 +99,19 @@ extern GArray *panel_keymap;
|
||||
extern GArray *input_keymap;
|
||||
extern GArray *tree_keymap;
|
||||
extern GArray *help_keymap;
|
||||
#ifdef USE_DIFF_VIEW
|
||||
extern GArray *diff_keymap;
|
||||
#endif
|
||||
|
||||
extern const global_keymap_t *panel_map;
|
||||
extern const global_keymap_t *input_map;
|
||||
extern const global_keymap_t *tree_map;
|
||||
extern const global_keymap_t *help_map;
|
||||
|
||||
#ifdef USE_DIFF_VIEW
|
||||
extern const global_keymap_t *diff_map;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
void do_update_prompt (void);
|
||||
int load_prompt (int fd, void *unused);
|
||||
|
@ -1085,6 +1085,10 @@ load_keymap_defs (void)
|
||||
help_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
|
||||
load_keymap_from_section ("help", help_keymap, mc_global_keymap);
|
||||
|
||||
#ifdef USE_DIFF_VIEW
|
||||
diff_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
|
||||
load_keymap_from_section ("diffviewer", diff_keymap, mc_global_keymap);
|
||||
#endif
|
||||
mc_config_deinit (mc_global_keymap);
|
||||
}
|
||||
}
|
||||
@ -1114,6 +1118,10 @@ free_keymap_defs (void)
|
||||
g_array_free (tree_keymap, TRUE);
|
||||
if (help_keymap != NULL)
|
||||
g_array_free (help_keymap, TRUE);
|
||||
#ifdef USE_DIFF_VIEW
|
||||
if (diff_keymap != NULL)
|
||||
g_array_free (diff_keymap, TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user