Ctrl-x keyboard bindings / mc 4.7.5.x

gator_ml at yahoo.de gator_ml at yahoo.de
Sat Apr 23 15:30:45 UTC 2011


Hi,

I had for ages been some patches to be able to use the traditional
Norton Commander keyboard shortcuts to change the panel sort order.
<Ctrl>-<Function key> doesn't work with most terminals, I changed my
XTerm keyboard translations to emit sequences starting with C-x instead.

In previous versions of MC (at least up to 4.6.2) I could add these key
bindings to "ctl_x_map" (src/main.c) like this:

static const key_map ctl_x_map[] = {
    {XCTRL ('c'), quit_cmd},
    {'d', compare_dirs_cmd},
	...
    { '0',          sort_cmd },
    { '1',          sort_left_cmd },
    { '2',          sort_right_cmd },
	...

Now I tried to port this to the latest mc version. It looks like there
are even provisions for most of these commands already provided
(CK_PanelSelectSortOrder, CK_PanelSortOrderByName ...)

As far as I could figure out, "ctl_x_map seems" to be
"default_main_x_map" (keybind-defaults.c) now, so I just tried to add
some stuff to this table:
const global_keymap_t default_main_x_map[] = {
    {'d', CK_CompareDirsCmd, "d"},
	...
    { '0', CK_Sort, "0" },
    { 'x', CK_Sort, "F1" },
    	...

Bindings for "CK-Sort" are already present, so I thought this should
work right out of the box. I also tried some other C-x bindings with
other predefined commands but none of them was ever executed (The
default bindings like "C-x i" work).

What did I overlook?
How can I add more bindings to the C-x map in mc 4.7.5?

Regards,
                            Peter




More information about the mc-devel mailing list