mc startup with single specified path

2013-10-18 Thread Mike Smithson

Hello.

I'm having some puzzlement over the initial startup behavior of mc-4.8.10  
when paths are specified on the command line.


To quote the manual:

[quote]
   If  both  paths  are specified, the first path name is the  
directory to
   show in the left panel; the second path name is  the  directory   
to  be

   shown in the right panel.

   If one path is specified, the path name is the directory to show in  
the

   active panel; current directory is shown in the passive panel.

   If no paths are specified, current directory is  shown  in  the   
active
   panel;  value  of  other_dir  from  panels.ini is the directory  
to be

   shown in the passive panel.
[/quote]

Paragraph #1:
This seems correct and intuitive.

Paragraph #2:
What I *expect* to happen when I specify only one path on the command  
line, is for that directory to appear in the left panel with the focus on  
it. As it works right now, it appears to be random which panel it shows up  
in, and which panel has focus. I know that it depends on the last time I  
hit Save Setup and the setting of current_is_left in panels.ini, but it  
always seems to do the wrong thing. As a matter of fact, the behavior I'm  
witnessing, is that that specified directory appears in the *inactive*  
panel, and the CWD appears in the *active* panel. I think that is  
counter-intuitive, a bit annoying, and exactly *not* what the manual says.


Paragraph #3:
This also seems correct and intuitive. Resort to default behavior if  
nothing is specified.


---

I believe the issue is in midnight.c, static void create_panels(), around  
lines 619-624 and 646-651, both bits are identical, and they shouldn't be:

[code]
else/* mc_run_param0 != NULL  mc_run_param1  
== NULL */

{
/* one argument */
current_dir = NULL; /* assume current dir */
other_dir = (char *) mc_run_param0;
}
[/code]
Is it just me, or does this seem *exactly* backwards?

I've changed these bits like this (the 1st is when the left panel is  
active):


[code]
--- midnight.c~ 2013-08-02 11:02:40.0 -0700
+++ midnight.c  2013-10-16 13:59:48.541659334 -0700
@@ -619,8 +619,8 @@ create_panels (void)
 else/* mc_run_param0 != NULL  mc_run_param1  
== NULL */

 {
 /* one argument */
-current_dir = NULL; /* assume current dir */
-other_dir = (char *) mc_run_param0; /* Wrong. */
+current_dir = (char *) mc_run_param0; /* Left panel gets the  
path */

+other_dir = NULL; /* assume other dir */
 }
 }
 else
@@ -648,6 +648,7 @@ create_panels (void)
 /* one argument */
 current_dir = NULL; /* assume current dir */ ;
 other_dir = (char *) mc_run_param0; /* Left panel gets the  
path */
+boot_current_is_left = TRUE; /* make left panel active (user  
called it, there must be a reason.) */

 }
 }
[/code]

and it now behaves the way I would expect.

After doing a bit more research, it looks as if create_panels() was  
freshly re-written for 4.8.10. In 4.8.9 I see this bit:

[code]
if (mc_run_param0 != NULL)
{
current_dir = NULL;
other_dir = (char *) mc_run_param0;
}
else
{
current_dir = NULL;
other_dir = mc_run_param1;
}
[/code]
Hmmm... Is it even possible to have mc_run_param1 *without* mc_run_param0?  
Also, what if both are set? No wonder it got re-written.


--
Peace and Cheer
___
mc-devel mailing list
https://mail.gnome.org/mailman/listinfo/mc-devel


Re: mc startup with single specified path

2013-10-18 Thread Egmont Koblinger
Please start with looking around in the bugtracker or compiling the
development version next time :)  The issue is already fixed for the
forthcoming 4.8.11.


egmont

On Fri, Oct 18, 2013 at 3:44 PM, Mike Smithson mdooli...@gmail.com wrote:
 Hello.

 I'm having some puzzlement over the initial startup behavior of mc-4.8.10
 when paths are specified on the command line.

 To quote the manual:

 [quote]
If  both  paths  are specified, the first path name is the directory
 to
show in the left panel; the second path name is  the  directory  to
 be
shown in the right panel.

If one path is specified, the path name is the directory to show in
 the
active panel; current directory is shown in the passive panel.

If no paths are specified, current directory is  shown  in  the
 active
panel;  value  of  other_dir  from  panels.ini is the directory to
 be
shown in the passive panel.
 [/quote]

 Paragraph #1:
 This seems correct and intuitive.

 Paragraph #2:
 What I *expect* to happen when I specify only one path on the command line,
 is for that directory to appear in the left panel with the focus on it. As
 it works right now, it appears to be random which panel it shows up in, and
 which panel has focus. I know that it depends on the last time I hit Save
 Setup and the setting of current_is_left in panels.ini, but it always seems
 to do the wrong thing. As a matter of fact, the behavior I'm witnessing, is
 that that specified directory appears in the *inactive* panel, and the CWD
 appears in the *active* panel. I think that is counter-intuitive, a bit
 annoying, and exactly *not* what the manual says.

 Paragraph #3:
 This also seems correct and intuitive. Resort to default behavior if nothing
 is specified.

 ---

 I believe the issue is in midnight.c, static void create_panels(), around
 lines 619-624 and 646-651, both bits are identical, and they shouldn't be:
 [code]
 else/* mc_run_param0 != NULL  mc_run_param1 ==
 NULL */
 {
 /* one argument */
 current_dir = NULL; /* assume current dir */
 other_dir = (char *) mc_run_param0;
 }
 [/code]
 Is it just me, or does this seem *exactly* backwards?

 I've changed these bits like this (the 1st is when the left panel is
 active):

 [code]
 --- midnight.c~ 2013-08-02 11:02:40.0 -0700
 +++ midnight.c  2013-10-16 13:59:48.541659334 -0700
 @@ -619,8 +619,8 @@ create_panels (void)
  else/* mc_run_param0 != NULL  mc_run_param1
 == NULL */
  {
  /* one argument */
 -current_dir = NULL; /* assume current dir */
 -other_dir = (char *) mc_run_param0; /* Wrong. */
 +current_dir = (char *) mc_run_param0; /* Left panel gets the
 path */
 +other_dir = NULL; /* assume other dir */
  }
  }
  else
 @@ -648,6 +648,7 @@ create_panels (void)
  /* one argument */
  current_dir = NULL; /* assume current dir */ ;
  other_dir = (char *) mc_run_param0; /* Left panel gets the path
 */
 +boot_current_is_left = TRUE; /* make left panel active (user
 called it, there must be a reason.) */
  }
  }
 [/code]

 and it now behaves the way I would expect.

 After doing a bit more research, it looks as if create_panels() was freshly
 re-written for 4.8.10. In 4.8.9 I see this bit:
 [code]
 if (mc_run_param0 != NULL)
 {
 current_dir = NULL;
 other_dir = (char *) mc_run_param0;
 }
 else
 {
 current_dir = NULL;
 other_dir = mc_run_param1;
 }
 [/code]
 Hmmm... Is it even possible to have mc_run_param1 *without* mc_run_param0?
 Also, what if both are set? No wonder it got re-written.

 --
 Peace and Cheer
 ___
 mc-devel mailing list
 https://mail.gnome.org/mailman/listinfo/mc-devel
___
mc-devel mailing list
https://mail.gnome.org/mailman/listinfo/mc-devel


Fwd: MC Tabs

2013-10-18 Thread Cosmin Popescu
-- Forwarded message --
From: Cosmin Popescu cosminpope...@members.fsf.org
Date: Tue, Oct 15, 2013 at 8:37 PM
Subject: Re: MC Tabs
To: Egmont Koblinger egm...@gmail.com


Dear Egmont,

I will answer your observations one by one:

your patch desperately
lacks the move this tab to the other panel (or something similar)
option with menu entries and convenient shortcuts, or maybe ^U could
just swap two tabs but not two whole panels.  Or, tabs should not be
per-panel but common to the two, in each panel you could easily jump
to any of the tabs.

--

I can certainly add another option for the ^U shortcut (to move all tabs or
only the current tab). I can also add a menu entry to move the current tab
on the other panel. On the other hand, I prefer to have the tabs
separately. If anyhow, somebody wishes to have them common for both panels
I can develop something like this (as an option) to be included in mc. But
for me, I don't think it's necessary.

==


Most of the Ctrl+Alt+letter combos are taken by my window manager, so
I'm back to entering Meta by pressing Escape.  Still, Esc followed by
C-Left or C-Right or C-g don't work for me, I'm not sure why.



Since I wasn't sure that I know all the shortcuts of MC, I preferred not to
put any default shortcuts and expose my menu options to a keymap file. So
normally you should be able to assign any shortcut that your terminal
permits to any function that I've implemented.

===

The current UI trend (apart from a couple of legacy apps that had tab
support before it became widely used) is to place tabs on the top,
rather than the bottom.

--

I copied the krusader, which has by default the tabs on the bottom. But,
just like for krusader, I was thinking to add the possibility in the tabs
options to choose where the tab bar should be implemented. I choose to
begin with printing them down because it was easier to implement just by
following the existing code.

===


The create tab and such menu options operate on the currently active
panel, rather than on the Left/Right panel according to whose menu
entry is selected.  (E.g. Left panel is active, invoke Right-Create,
a new tab should be created on the right panel.)

---

I don't know why I was under the impression that the other options work the
same way. I've checked again now and you are right. I will correct this and
send you again another patch.




Tabs should be selectable by a single mouse click (also scrolling
should be doable by mouse if too many tabs are open to fit).

-

The truth is that I don't use the mouse with mc. This is why the tabs are
not responsive to the mouse. But again, if you would like to include it in
the official code repository I can also make it responsive to the mouse.




Having non-ascii characters (don't forget about CJK either) cause
artifacts with highlighing the active tab (the end of the tab bar gets
the highlighed background too).



I think the issue there is that I used the strlen function. I will have a
look. I only checked with normal UTF-8 characters.




One more thing: please use unified diffs, they are much more reable
and more portable to newer mc versions.

-

The next patch I will send I will use unified diffs.


On Tue, Oct 15, 2013 at 8:37 PM, Egmont Koblinger egm...@gmail.com wrote:

 Hi Cosmin,

 This is a very interesting idea.  Please let me give feedback after 5
 minutes of using it :) Please note that I'm not an official mc
 developer, just an occasional contributor.

 I always wondered why mc has hardcodedly only 2 panels, not allowing
 more.  E.g. the screen could be divided in 2x2 parts and copy/move
 operations could have a direction (horizontal, vertical or diagonal).
 Your new feature approaches a similar goal.

 To accomplish the above mentioed goal, i.e. to be able to have 3
 panels and quickly copy between *any* two, your patch desperately
 lacks the move this tab to the other panel (or something similar)
 option with menu entries and convenient shortcuts, or maybe ^U could
 just swap two tabs but not two whole panels.  Or, tabs should not be
 per-panel but common to the two, in each panel you could easily jump
 to any of the tabs.

 Basic tab operations (next/prev/new/close) should also be something
 that has convenient short hotkeys by default, and those hotkeys are
 mentioned in the 

Re: MC Tabs

2013-10-18 Thread Cosmin Popescu
Yes, you are right, I didn't intended to answer only to you. I will forward
the other e-mail to the list.



On Tue, Oct 15, 2013 at 10:00 PM, Egmont Koblinger egm...@gmail.com wrote:

 Hi Cosmin,

 I see you responded to me privately, rather than to the list.  I'm not
 sure if this was your intent.

  I can certainly add another option for the ^U shortcut (to move all tabs
 or
  only the current tab). I can also add a menu entry to move the current
 tab
  on the other panel. On the other hand, I prefer to have the tabs
 separately.
  If anyhow, somebody wishes to have them common for both panels I can
 develop
  something like this (as an option) to be included in mc. But for me, I
 don't
  think it's necessary.

 I'm not sure either.  It's the use case I had in mind: I have 3
 directories (A, B, C), and I'd like to copy files from A to B, from B
 to C, and from A to C (or C to A, whatever).  With your current
 design, at least one of them would needed to be duplicated in both
 panels (e.g. left panel: A and C, right panel: B and C), which is not
 necessarily bad, I'm just wondering if it's a bit too complicated and
 a different design would make it simpler.  This is really just a heads
 up that this use case might also be valid.  I'm really not sure what
 the best solution would be, I've never used a two-panel filemanager
 with tab support, so apparently you have more experience here.

 Also, config options that heavily change the behavior are IMHO usually
 a bad idea.  A config option for having the tabs on the top or bottom
 or hidden is fine.  The ones you have now (where the new tabs open)
 take effect only at one particular well defined part of the source,
 these are also okay.  But having an option for per-panel or global
 tabs would IMHO be a maintainability nightmare, as plenty of things
 would behave very differently in the two worlds.  Probably it's better
 to decide on one and implement that only.  Your approach fits much
 better the generic concept of how tabs work (even though it's uncommon
 to have two tab bars), while mine addresses a particular use case I
 had in my mind, but the relation of the panel and tab bars would be
 uncommon.  Anyway, it's something for you to think about, and if you
 (and other commenters) decide to keep the current design, I'm totally
 fine with that :)

  The truth is that I don't use the mouse with mc. This is why the tabs are
  not responsive to the mouse. But again, if you would like to include it
 in
  the official code repository I can also make it responsive to the mouse.

 It's not just my personal preference.  Mouse works all across MC, I'm
 sure the mainstream developers wouldn't accept your patch without
 mouse support (and I'd agree with this decision).

 Thanks again, let's wait to see what others say.


 egmont

___
mc-devel mailing list
https://mail.gnome.org/mailman/listinfo/mc-devel