Add commands to activate last tab and to move current tab

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

lucatrv
Junior Member
Junior Member
Posts: 9
Joined: 2014-02-16, 17:29 UTC

Add commands to activate last tab and to move current tab

Post by *lucatrv »

Hi,

Total Commander provides all a series of commands to activate a specific tab, such as "cm_SrcActivateTab1", "cm_TrgActivateTab1", "cm_LeftActivateTab1", "cm_RightActivateTab1" etc.
For each of these categories, it would be useful to add a command to activate the last tab, for instance "cm_SrcActivateTabLast" etc.
The user could then define a shortcut, for instance "Ctrl + 9" as in Firefox.

Moreover, it would be useful to add two commands to move the current tab to the left or to the right, for instance "cm_MoveCurrentTabLeft" and "cm_MoveCurrentTabRight". The user could then define two shortcuts, for instance "Ctrl + Shift + PageUp" and "Ctrl + Shift + PageDown" as in Firefox.

Regards
User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

Post by *ts4242 »

What do you mean by "activate the last tab"?

There are cm_FocusLeft and cm_FocusRight
it would be useful to add two commands to move the current tab to the left or to the right, for instance "cm_MoveCurrentTabLeft" and "cm_MoveCurrentTabRight".
Use cm_Exchange
lucatrv
Junior Member
Junior Member
Posts: 9
Joined: 2014-02-16, 17:29 UTC

Post by *lucatrv »

Hi, sorry I should have explained better.

With "activate the last tab" I mean to activate the last tab among the ones open in the current panel. If I have 5 tabs open in the current panel, it means to select the 5th tab. If I have 50 tabs open, it means to select the 50th one. This is convenient when you have an unknown number of tabs open.

With "move the current tab left/right" I mean to "drag" the current tab across other tabs. This is convenient to reorganize tabs using the keyboard. In Total Commander at present the only way to reorganize tabs is to click and drag them using the mouse.

Please see also the Firefox shortcuts "Select Last Tab", "Move Tab in focus Left" and "Move Tab in focus Right" (first link googling "firefox shortcuts").

Thanks
User avatar
solid
Power Member
Power Member
Posts: 747
Joined: 2004-08-09, 11:20 UTC

Post by *solid »

Why should anyone have 50 (even more than 10) tabs open in TC?
Personally, i have no more than 3-5 tabs on both sides. It is more time consuming to find the right tab among the many than to open the dir from directory hotlist or just navigate to the wanted dir.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Indeed it would be better to use the directory menu (Ctrl+D) to handle that many directories.
Author of Total Commander
https://www.ghisler.com
lucatrv
Junior Member
Junior Member
Posts: 9
Joined: 2014-02-16, 17:29 UTC

Post by *lucatrv »

My original post contained two suggestions: focusing the last tab and moving the current tab (I should have probably kept the two points in two separate posts).

Regarding moving the current tab, I did not receive comments, so I guess you agree? Even with 3 tabs open someone might need to reorganize them (that is way it is possible to drag the tabs with the mouse, isn't it?) so of course it would be better to be able to do that with the keyboard (as TC users like to do).

Regarding focusing the last tab, I already use the Ctrl+D keystroke and I confirm it is useful. However I also like to keep some tabs open so as to keep track of what I need to do between TC sessions. I would like to better explain my use case. I use the option "Open new tabs near current tab" to keep similar tabs close by. Now, suppose there are 5 tabs open, and the 2nd one is focused. If I want to open a new tab on the right (so that it becomes the 6th one) I need first to move to tab 5, and then to press Ctrl+T. That is why I would like to be able to define a keystroke (for instance Ctrl+9 as in Firefox) to focus the last tab (the 5th tab in the example above).

On a side note, I wonder why there are commands like "cm_SrcActivateTab10 ((up to 99 items))" if just a couple of tabs should be kept open in TC.

Thanks for you feedback.
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

A script would be able to do so.
It would parse the saved-tab.ini to check how many tabs there are, then send the command to TC to cm_SrcActivateTab## -- where ## is how many tabs were found in the saved-tab.ini

Of course, a single command that could take arguments would be the best instead of 200 commands to activate up to 99th tab left/right.

ActivateSrcTab 1 ; First Tab
ActivateSrcTab -1 ; Last Tab

ActivateSrcTabOffset 3 ; Activate 3 tabs to the right of current.
ActivateSrcTabOffset -2 ; Activate 2 tabs to the left of current.

4 Commands that are able to take an integer argument would replace 200 that exist, and be more functional than those 200 Which are nearly useless since how does one even know what number a tab is without MANUALLY counting it.

Although this probably falls into the category of:

"You are holding it wrong." - Steve Jobs, iPhone.
meisl
Member
Member
Posts: 171
Joined: 2013-12-17, 15:30 UTC

Post by *meisl »

Balderstrom wrote:Although this probably falls into the category of:
"You are holding it wrong." - Steve Jobs, iPhone.
It does indeed. Making commands take arguments is a BIG change (=lots of effort), whereas lucatrv's proposal to add

Code: Select all

cm_[Src|Trg|Left|Right]ActivateTab[Last|First]
and

Code: Select all

cm_[Src|Trg|Left|Right]MoveActiveTab[Left|Right]
is not - while adding substantial functionality!
In fact, "cm_[Src|Trg|Left|Right]ActivateTabFirst" is already implemented by "cm_[Src|Trg|Left|Right]ActivateTab1".

Furthermore, the question of how many tabs are "sane" to have open should be entirly up to the user, and is immaterial for the suggestion at hand.
Then: the fact that Firefox has it should be enough proof of its usefulness.
Finally (but not least): in terms of implementation effort it's really not that big a thing. It's perfectly backwards-compatible (since it's pure addition) and it doesn't require a paradigm shift (as opposed to having commands take arguments). It should be no more than simply exposing as "cm_..." a little more of the functionality that's already there, and in the very same way as all the other "cm_..."s.

So, in total, +1 from my side for this suggestion :)
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

@meisl

The functionality for commands taking arguments is no change required at all.

It already exists. Thus, to implement 4 commands that take arguments, would be about the same "effort" as adding 4 commands that don't.

Yet 4 commands that take arguments are infinitely better than 4 that don't.

Total Commander HELP File wrote:
[Dialog box: Configuration - Change button bar]
...
#3/ cd [ directory name ]
#4/ ftpopen [ session_name ]
#5/ zipfromlist
...
appendtabs, opentabs, SYNCOPEN, LOADSEARCH, OPENBAR, MULTIRENAME, OPENCUSTOMVIEW, SELECTFILES
meisl
Member
Member
Posts: 171
Joined: 2013-12-17, 15:30 UTC

Post by *meisl »

Balderstrom wrote:The functionality for commands taking arguments is no change required at all.

It already exists.
Oh, didn't know that. In that case I agree with the rest as well, of course.

Could you point out a complete example "cm_XYZ" to me that takes an argument?
(I mean one that you can assign a keyboard-shortcut to, ideally with args %S, %P and the like)

Thanks :)
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

None of the existing commands cm_ take arguments.
You CAN create a user-defined command, aka "em_" that can take arguments.
You CAN create an alias that takes arguments

Although, since few commands exist that can take arguments, one is limited to what can be done internally with TC, as opposed to passing filelists from TC to outside scripts/programs/cmd/etc.

Now (with TC 8.50), TC natively support multiple commands in the button-bar, Which will allow you to intermingle em_'s and cm_'s in a single command=string. Though I haven't tested if whether when calling an em_ that refers to an external command, if TC waits until that program/window closes until it proceeds with the rest of the command-string.
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.
lucatrv
Junior Member
Junior Member
Posts: 9
Joined: 2014-02-16, 17:29 UTC

Post by *lucatrv »

Things can be done in many different ways, but in my opinion the Firefox shortcuts for tabs management should be a good reference because people are getting used to them and also other applications start adopting them:

http://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-tasks-quickly#w_windows-tabs

Basically Ctrl+1to8 select tabs from 1 to 8, while Ctrl+9 always selects the last tab. This assumes that you can keep track of up to 8 tabs by memory.
Ctrl+PgDn/PgUp select the next/previous tab, while Ctrl+Shift+PgDn/PgUp move the current tab right/left. Also I like enabling the shortcut Ctrl-Tab to select the last focused tab (available through the about:config configuration).

Actually, if I had to decide, I would enable these shortcuts in TC by default, as many people are now used to them. The conflict of Ctrl+PgUp with the current "change to parent directory" is actually not important as Backspace can be used instead, while Alt+PgDn could be used to open archives. In fact, shortcuts Ctrl+PgDn/PgUp to switch between tabs is supported by many applications nowadays, including Excel etc.

Also F2 for file renaming is nowadays widely used, so my wincmd.ini [Shortcuts] section always begins with the following lines:

F2=cm_RenameSingleFile
C+PGDN=cm_SwitchToNextTab
C+PGUP=cm_SwitchToPreviousTab
C+1=cm_SrcActivateTab1
C+2=cm_SrcActivateTab2
C+3=cm_SrcActivateTab3
C+4=cm_SrcActivateTab4
C+5=cm_SrcActivateTab5
C+6=cm_SrcActivateTab6
C+7=cm_SrcActivateTab7
C+8=cm_SrcActivateTab8
MaTa01
New Member
New Member
Posts: 1
Joined: 2014-08-16, 14:20 UTC

Post by *MaTa01 »

I second the idea of creating shortcuts for tab management.
sgp
Senior Member
Senior Member
Posts: 355
Joined: 2005-01-31, 16:04 UTC

Post by *sgp »

Did anyone notice that, contrary to the documentation, cm_SrcActivateTab11..99 throws an error? Likewise for the Trg command. This is TC 8.51a 32bit on WinXP SP3.

I have 32 tabs open in the left pane and 29 in the right pane. I make heavy use of tabs. I would really like to see improvements in this area.

One thing that complicates discussing tabs (and possibly enhancing them) is that there are two different lists to which each tab belongs. Disclaimer: I'm going to describe my own understanding of how TC works based on my own observations. If anyone know better, please jump in.

One list the the "temporal" list, ordered by time of creation of each tab. It's used in commands like cm_SrcActivateTabN, and dumped to file with SAVETABSTOFILE.
Another list is the "layout" list, by position in the tab ribbon (the multirow control that contains all tabs). cm_SwitchToPreviousTab/NextTab affects it. I'm not aware of a TC-only way to dump that list.
If you configure TC to "open new tab next to current" the ordering of the two lists will eventually differ. That's one complication.
Then there's APPENDTABS, which seems to append after the rightmost position of the **lowest** row in the tab ribbon regardless of "open new tab next to current". I *think* the new tabs are indeed appended to the end of the temporal list, and inserted somewhere in the middle of the "layout" list.

I can suggest another new command for tabs: CLOSETABSFROMFILE. It's the reverse operation of APPENDTABS. Personally I would use it like this. APPENDTABS "MyProject.tab", do some work on my project, then CLOSETABSFROMFILE "MyProject.tab". Neat and clean, IMO.

A huge, enabler for TC automation would be the ability to concatenate commands with parameters together. What I mean is that TC 8.50 introduced the ability to concatenate multiple cm_ commands in a button command or in the command line. For example,

cm_OpenNewTab,cm_SrcActivateTab1,cm_SwitchToPreviousTab

(that was an experiment, BTW), but it's limited to cm_ and user commands. The help file says:

2. You can also place one or more of Total Commander's internal menu commands here comma-separated. Just click on the button with the magnifying glass and choose a command from the dialog box "Choose command".

So you can't do (yet, hopefully) APPENDTABS "MyProject.tab",cm_SomeOtherThing.
User avatar
Hacker
Moderator
Moderator
Posts: 13052
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

sgp,
Did anyone notice that, contrary to the documentation, cm_SrcActivateTab11..99 throws an error?
Yes, well, one needs to add the commands to totalcmd.inc oneself.
So you can't do (yet, hopefully) APPENDTABS "MyProject.tab",cm_SomeOtherThing.
Perhaps you could create a new em_ command with APPENDTABS and use that one instead of APPENDTABS directly?

HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Post Reply