Alt-O behavior changed



Hello!

I remember many requests to change the behavior of Alt-O to something more 
useful and intuitive.  There is even a patch in PLD Linux Distribution 
(http://www.pld.org.pl/) that makes Alt-O change the other panel to the 
current directory of the current panel.

I have improved this patch so that if the other panel is not in the 
listing mode, it is put to the listing mode.  This makes Alt-O a simple 
way to cancel Quick View, Info and Tree mode on the other panel.

The current panel is not cloned.  If the current panel is panelized (I
don't like this word, but it's already used in the documentation), the
other panel doesn't become panelized.  It is intentional - it makes it
possible to use Alt-O to cancel panelization on the other panel.

The patch has been applied, and the English documentation has been
updated.  Please check that the new behavior is convenient.  It would be
better if any adjustments are done before the release.

The patch:
====================================
--- doc/mc.1.in
+++ doc/mc.1.in
@@ -432,11 +432,10 @@
 move the selection bar one page up.
 .TP
 .B M-o
-if the other panel is a listing panel and you are standing on a
-directory in the current panel, then the other panel contents are set
-to the contents of the currently selected directory (like Emacs' dired
-C-o key) otherwise the other panel contents are set to the parent dir
-of the current dir.
+make the current directory of the current panel also the current
+directory of the other panel.  Put the other panel to the listing mode
+if needed.  If the current panel is panelized, the other panel doesn't
+become panelized.
 .TP
 .B C-PageUp, C-PageDown
 only when ran on the Linux console: does a chdir to ".." and to the
--- src/screen.c
+++ src/screen.c
@@ -1949,26 +1949,22 @@ do_enter (WPanel *panel)
     return do_enter_on_file_entry (selection (panel));
 }
 
+/*
+ * Make the current directory of the current panel also the current
+ * directory of the other panel.  Put the other panel to the listing
+ * mode if needed.  If the current panel is panelized, the other panel
+ * doesn't become panelized.
+ */
 static void
 chdir_other_panel (WPanel *panel)
 {
-    char *new_dir;
-
-    if (get_other_type () != view_listing)
-	return;
-
-    if (!S_ISDIR (panel->dir.list [panel->selected].buf.st_mode))
-	new_dir = concat_dir_and_file (panel->cwd, "..");
-    else
-	new_dir = concat_dir_and_file (panel->cwd, panel->dir.list [panel->selected].fname);
+    if (get_other_type () != view_listing) {
+	set_display_type (get_other_index (), view_listing);
+    }
 
     change_panel ();
-    do_cd (new_dir, cd_exact);
+    do_cd (panel->cwd, cd_exact);
     change_panel ();
-
-    move_down (panel);
-
-    g_free (new_dir);
 }
 
 static void
====================================

-- 
Regards,
Pavel Roskin




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