Enjoy Shift-F7 on Linux console!



Hello!

I've just fixed a nasty bug in MC that existed since MC was put on CVS in
1998.  Keyboard settings from the generic file mc.lib have preference over
the user settings from ~.mc/ini.

mc.lib defines keys for the terminals: console, linux, xterm, xterm-color
and ibmpc3.  The definitions for the "linux" terminals assume that
Shift-F1 is F11, Shift-F2 is F12 and so on, just like in xterm.

Unfortunately, some keyboard maps for Linux make Shift-F1 emit the
sequence that other vt100-like terminals would use for F13, and so on.
However, the terminal name is still "linux".  On such terminals, pressing
e.g. Shift-F7 to continue search in the editor would invoke a message box
saying "You must first highlight a block of text".

Smart users went to "Learn keys" and MC gladly accepted the new keys ...
until it was restarted.  Because mc.lib had preference over user settings.
Not anymore.

ChangeLog:
	* setup.c (load_keys_from_section): Give ~/.mc/ini preference
	over mc.lib.

------------------------------
--- setup.c
+++ setup.c
@@ -731,11 +731,15 @@ load_keys_from_section (char *terminal,
 void load_key_defs (void)
 {
     char *libfile = concat_dir_and_file (mc_home, "mc.lib");
-    load_keys_from_section (getenv ("TERM"), profile_name);
-    load_keys_from_section ("general", profile_name);

+    /*
+     * Load keys from mc.lib before ~/.mc/ini, so that the user
+     * definitions override global settings.
+     */
     load_keys_from_section (getenv ("TERM"), libfile);
     load_keys_from_section ("general", libfile);
+    load_keys_from_section (getenv ("TERM"), profile_name);
+    load_keys_from_section ("general", profile_name);

     /* We don't want a huge database loaded in core */
     free_profile_name (libfile);
------------------------------

The documentation will be fixed separately.  The existing description of
mc.lib is too vague: "Settings in this file are global to any Midnight
Commander". :-)

-- 
Regards,
Pavel Roskin





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]