Re: Restoring the functionality of Alt-o



Pavel Shirshov (pchel) wrote:

Hello Miguel,

Sunday, January 30, 2005, 9:40:03 AM, you wrote:

MdI>     A long time ago I added Alt-o as a binding that would help in
MdI> navigating directories.  The idea is that in one panel you press Alt-o,
MdI> and if the selection is on a directory, it will load the contents of the
MdI> highlighted directory into the other panel.  If no directory was
MdI> selected, this was a no-op.

MdI>     At some point this behavior was removed from mc, and now instead it
MdI> just loads the current directory on the other panel, which is not very
MdI> useful for navigating anything.

    http://mail.gnome.org/archives/mc-devel/2002-November/msg00039.html

MdI>     I remember having this discussion with Pavel but I forget the
MdI> rationale for it.  I would like to get this change reverted in CVS.  Any
MdI> objections?

    I'm agreed with you. Old behavior of ALT-O is more good.

Yes, the old variant is more preferable, and we patch upstream releases each time for it. My variant attached (as an example). It is against latest RedHat`s fedora-devel build.

--
		Dmitry Butskoj <buc citadel stu neva ru>
		Saint-Petersburg, Russia
		Red Hat Certified Engineer 809003662809495

diff -Nrbu mc-4.6.1-20041108/src/screen.c mc-4.6.1-20041108-OK/src/screen.c
--- mc-4.6.1-20041108/src/screen.c	2004-11-23 20:05:42.000000000 +0300
+++ mc-4.6.1-20041108-OK/src/screen.c	2004-11-23 20:05:30.000000000 +0300
@@ -2140,25 +2140,25 @@
     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) {
 	set_display_type (get_other_index (), view_listing);
     }
 
-    do_panel_cd (other_panel, current_panel->cwd, cd_exact);
+    if (!S_ISDIR (panel->dir.list [panel->selected].st.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);
+
+    do_panel_cd (other_panel, new_dir, cd_exact);
 
-    /* try to select current filename on the other panel */
-    if (!panel->is_panelized) {
-	try_to_select (other_panel, selection (panel)->fname);
-    }
+    move_down (panel);
+
+    g_free (new_dir);
 }
 
 static void


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