Copy full filename to command line (Ctrl-F) patch

Walery Studennikov despair at sama.ru
Wed Aug 1 05:25:08 UTC 2001


On Wed, Aug 01, 2001 at 12:58:49AM -0400, Pavel Roskin wrote:
> On Wed, 1 Aug 2001, Walery Studennikov wrote:
> 
> > Here is slightly purified and adapted to CVS version of MC patch
> > from Max Schedriviy.
> >
> > It allows to copy full filename (with path) by pressing Ctrl-F.
> > It is certainly more quick and convenient than using Alt-A + Ctrl-Enter.
> 
> Please always comment the code if you are sending the patch.  Don't expect
> everybody to understand it.
> 
> Few questions/remarks:
> 
> Why are you using copy_full_prog_name() in two places - once in the table
> and then by calling it explicitly?  Cannot we just do it is one place?  If
> not, then I would like to fix the existing code first.

Done.
 
> Why is copy_full_prog_name() global?  It should be static.  It's
> nitpicking, but when I analyze an impact of a change in a global function
> I have to scan the whole project for possible calls.

Yes, it should be static.
The new version of patch is attached.

> MC traditionally has symmetric shortcuts for the current and the other
> panel, like "Atl-a" and "Alt-A" and even "Ctrl-x r" and "Ctrl-x Ctrl-r"
> (I've never used the later - copy readlink from the other panel).  There
> is no shortcut to copy the filename on the other panel.  Shouldn't we have
> counterparts for Ctrl-Enter and the proposed Ctrl-F to work with the other
> panel?

IMHO commands for other panel is not so useful.
 
> Where does Ctrl-F come from?  It's better that every shortcut is already
> used somewhere, so that at least some people don't have to re-learn.

. From the FAR manager. Just the other way about many people having
experience with FAR manager expects this functionality.
 
> This patch adds a new user-visible feature.  It should be documented.  I
> know that mc.1.in is an unpleasant file to work with, but nobody has
> converted it to SGML yet.

mc.1.in.diff is attached.
Strage, but I have't found description for Meta-A there.
 
> -- 
> Regards,
> Pavel Roskin

Regards, Walery
-------------- next part --------------
--- mc.1.in.orig	Wed Aug  1 10:13:48 2001
+++ mc.1.in	Wed Aug  1 10:14:27 2001
@@ -451,6 +451,9 @@
 .B C-Enter.
 Same a M-Enter, this one only works on the Linux console.
 .PP
+.B C-F.
+Copy the currently selected file name with full path to the command line.
+.PP
 .B M-Tab.
 Does the filename, command, variable, username and hostname
 .\"LINK2"
-------------- next part --------------
--- main.c.orig	Wed Aug  1 08:43:56 2001
+++ main.c	Wed Aug  1 10:23:52 2001
@@ -1574,6 +1574,7 @@
 }
 #endif
 
+
 #ifndef HAVE_GNOME
 static void copy_current_pathname (void)
 {
@@ -1645,6 +1646,13 @@
     g_free (tmp);
 }   
 
+/* copy filename with full path to command line - mAX */
+static void copy_full_prog_name (void)
+{
+    copy_current_pathname ();
+    copy_prog_name ();
+}
+
 static void copy_tagged (WPanel *panel)
 {
     int i;
@@ -1817,6 +1825,7 @@
     { ESC_CHAR,   nothing },
     { XCTRL('c'), nothing },
     { XCTRL('g'), nothing },
+    { XCTRL('f'), copy_full_prog_name },
     { 0, 0 },
 };
 
@@ -2007,7 +2016,7 @@
 	    send_message_to (h, (Widget *) cmdline, WIDGET_KEY, id);
 	    return MSG_HANDLED;
 	}
-
+     
 	if ((!alternate_plus_minus || !(console_flag || xterm_flag)) &&
              !quote && !cpanel->searching) {
 	    if(!only_leading_plus_minus) {


More information about the mc-devel mailing list