Solved [TC 10 b8] files types saved for tabs might get reset when going to a tab where Auto Switch Mode applies

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Solved [TC 10 b8] files types saved for tabs might get reset when going to a tab where Auto Switch Mode applies

Post by *petermad »

history.txt wrote:23.04.21 Added: Save displayed file types (e.g. *.txt) separately for each tab (32/64)
Thanks for this useful feature :-)

I encounter a problem though, if I have set filters for some tabs, and then click on a tab for which an Auto Switch Mode applies - in that case the file filter for the last actives tab gets reset to *.* when I later click on that tab. There also has to be a view mode set for folders (L) with "Auto-run commands:" set to: *cm_SrcAllFiles

To reproduce:
1. Start TC with an ini file with these settings for ViewModes and ViewModeSwitch:

Code: Select all

[ViewModes]
0_name=<default>
0_icon=%COMMANDER_EXE%,6
0_options=-1|-1|0||-1|-1|-1|-1|-1
1_name=Folder
1_icon=%COMMANDER_EXE%,6
1_commands=*cm_SrcAllFiles
1_options=-1|-1|0||-1|-1|-1|-1|-1
2_name=Test2
2_icon=%COMMANDER_EXE%
2_options=-1|-1|0||-1|-1|-1|-1|-1

[ViewModeSwitch]
Enabled=1
0_rules=+C:\test2\*\
0_mode=2
1_rules=L1235
1_mode=1
2. Make a C:\test directory with two sub-directories dir1 and dir2
3: Make a C:\test2 directory
4. Open three folder tabs for C:\test, C.\test\dir1 and c:\test\dir2
5. Set a different file type display for C:\test, C:\test\dir1 and C:\test\dir2
6. Click consecutively on the tabs to ensure that the chosen file types are displayed, end up with the second tab (C:\test\dir1) as the active tab.
7. Click on the first tab (C:\test) and go to C:\test2 in this tab.
8. Click on the second tab (C:\test\dir1) - the file display filter is now lost for this tab.
9. Click on the third tab (C:\test\dir2) - the file display filter is still active for this tab.
10. Click on the first tab (C:\test2) and then again on the third tab (C:\test\dir2) - the file display filter is now also lost for this tab.
Last edited by petermad on 2021-05-20, 19:17 UTC, edited 1 time in total.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
tuska
Power Member
Power Member
Posts: 3741
Joined: 2007-05-21, 12:17 UTC

Re: [TC 10 b8] files types saved for tabs might get reset when going to a tab where Auto Switch Mode applies

Post by *tuska »

Hi,

I have the following explanations for this behaviour:

As long as you only click to switch between tabs with filters, the view mode remains unchanged ("nothing changes").
c:\Test\*.jpg
c:\Test\dir1\*.txt
c:\Test\dir2\*.doc

However, if you change e.g. from C:\ to c:\Test\, the filter c:\Test\*.jpg will be removed, namely
because of the View mode "Folder" with Auto-run command: *cm_SrcAllFiles.

Changing e.g. from c:\Test\*.* to c:\Test\dir1\*.txt ["per cd"] also triggers the View mode, i.e. the filter is removed.

The situation is different when changing from c:\Test2\*.java to c:\Test\*.jpg or c:\Test\dir1\*.txt or c:\Test\dir2\*.doc.
This changes from one View mode to another View mode and thus applies the View mode of the target in this case.
C:\Test (L c:\directory) has the View mode "Folder" and thus the filter is removed from the target directory.

From my point of view, this is not a bug.

Regards,
Karl
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 10 b8] files types saved for tabs might get reset when going to a tab where Auto Switch Mode applies

Post by *petermad »

2tuska
However, if you change e.g. from C:\ to c:\Test\, the filter c:\Test\*.jpg will be removed, namely
because of the View mode "Folder" with Auto-run command: *cm_SrcAllFiles.
I am aware of that - of course the filter shall change in the tab where I change directory - but why should the view mode change also be applied to the other tabs when I click on them? The other tabs should be left untouched, since no directory change has taken place in them.

Notice - I am NOT changing the directory in the second and third tab - I am only clicking on the tabs after having changed directory in the first tab.

Also, if I afters step 7 here above hover over the second and the third tab, then the filter is shown in the help text, and not until I click the second tab is the filter removed.

Also notice, that if I then click on the third tab, then the filter for that tab is still in effect - it is not until I have clicked the first tab and then the third tab again that the fileter for this tab is lost.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
tuska
Power Member
Power Member
Posts: 3741
Joined: 2007-05-21, 12:17 UTC

Re: [TC 10 b8] files types saved for tabs might get reset when going to a tab where Auto Switch Mode applies

Post by *tuska »

petermad wrote: 2021-04-30, 00:52 UTC ... but why should the view mode change also be applied to the other tabs when I click on them?
The other tabs should be left untouched, since no directory change has taken place in them.

Notice - I am NOT changing the directory in the second and third tab - I am only clicking on the tabs after having changed directory in the first tab.
The View mode does not change when you switch between tabs with filters by clicking and the tabs have the same View mode:

Code: Select all

C:\Test\... View mode "Folder" ... *cm_SrcAllFiles
However, if you change

Code: Select all

FROM: C:\Test2 with View mode "Test2"
TO  : C:\Test  with View mode "Folder" ... *cm_SrcAllFiles
then there is a switch between folders with different View modes(!)
A View mode is retained until it is replaced by another View mode.

> 7. Click on the first tab (C:\test) and go to C:\test2 in this tab.
c:\Test\*.jpg -> c:\Test2\*.java -> Filter is retained for c:\Test2\ -> OK

> 8. Click on the second tab (C:\test\dir1) - the file display filter is now lost for this tab.
c:\Test2\*.java -> c:\Test\dir1\*.txt -> Filter is deleted due to View mode "Folder" *cm_SrcAllFiles -> OK
Here the View mode "Test2" is switched to the View mode "Folder" *cm_SrcAllFiles!

9. Click on the third tab (C:\test\dir2) - the file display filter is still active for this tab.
c:\Test\dir1\*.txt -> c:\Test\dir2\*.doc -> Filter is retained because nothing has changed in the View mode "Folder" -> OK

> 10. Click on the first tab (C:\test2) and then again on the third tab (C:\test\dir2) - the file display filter is now also lost for this tab.
c:\Test2\*.java, c:\Test\dir2\*.doc -> same as point 8. ...
The View mode "Test2" is switched to the View mode "Folder" *cm_SrcAllFiles!
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 10 b8] files types saved for tabs might get reset when going to a tab where Auto Switch Mode applies

Post by *petermad »

2tuska
What you explain might be the cause, but I think that view modes should not be changed in a tab if no directory change has taken part in THAT tab.
A View mode is retained until it is replaced by another View mode.
Yes, but what I expect is:
"A View mode is retained until it is replaced by another View mode in the same tab."

After all - the option is called: "Automatically switch mode on directory change" - and clicking on another folder tab is not a directory change in my book.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
tuska
Power Member
Power Member
Posts: 3741
Joined: 2007-05-21, 12:17 UTC

Re: [TC 10 b8] files types saved for tabs might get reset when going to a tab where Auto Switch Mode applies

Post by *tuska »

2petermad
petermad wrote: 2021-04-30, 09:49 UTC 2tuska
What you explain might be the cause, but I think that view modes should not be changed in a tab
if no directory change has taken part in THAT tab.
For me, there is no question that a View mode must switch off the set filter at some point,
because otherwise there will always be a filtered view.

I also had this problem here:
Buttons|em_commands - usercmd.ini|View Modes| wrote:... there is a solution but with a restriction:
You can switch between tabs with filters, but *per TC window* you ALWAYS have to switch to a tab without filter in between! *)
*) (Reason: After leaving the 'View mode', the filter must be switched off -> cm_SrcAllFiles).
The question for me is how to teach a View mode that it should execute a command -> *cm_SrcAllFiles
and not to do it at other times - for me this is not possible.
It is possible to use compound commands and to restore a View mode with command: cm_RereadSource 2,
nevertheless, I have not yet succeeded in achieving an automatic conversion on the subject of "tab with filter".

At the moment, the only solution - with regard to a View mode - I can see is the following:
Switch filter to tab ON: View mode + Auto Switch Mode or manually e.g. via button.
Switch filter to tab OFF: Manually via button or shortcut and NOT automatically.

With regard to the procedure considered above (points 7.-10.), I think that it would then require an EXCEPTION for filters
to switch to tabs with regard to View mode/Auto Switch Mode.
petermad wrote: 2021-04-30, 09:49 UTC
A View mode is retained until it is replaced by another View mode.
Yes, but what I expect is:
"A View mode is retained until it is replaced by another View mode in the same tab."
petermad wrote: 2021-04-30, 09:49 UTC After all - the option is called: "Automatically switch mode on directory change" -
and clicking on another folder tab is not a directory change in my book.
But it is also a fact that the following happens, namely
- After clicking on another tab, another directory is displayed and the View mode "Test2" from the previous tab no longer applies.
- for the other directory there is another View mode "Folder" with Auto Switch Mode [with Auto-run commands: command].

I'm running out of steam on this topic now... ;-)
I would therefore like to wait for a decision by the author...
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 10 b8] files types saved for tabs might get reset when going to a tab where Auto Switch Mode applies

Post by *ghisler(Author) »

This is indeed a difficult situation:
The auto-switch rule 1 applies to all directories on your harddisk, except for c:\test2, which is handled by rule 0.
Rule 1 sets view mode "Folder", which defines command *cm_SrcAllFiles - the * instructs TC to execute it on every directory change. Without the *, it would only be executed when the view mode changes.

So when you switch to any other directory than c:\test2, TC should switch to cm_SrcAllFiles. I made an exception when changing tabs, but only if the view mode didn't change. If the view mode does change between tabs, I have to execute the commands in any case, because they may be necessary for that view mode.

For example, I have defined a view mode for thumbnails view for my photos folder. This has set the following command:
cm_100Percent 70|cm_50Percent

So the panel switches to 70% width when in the photos folder, and back to 50% width when in another folder. If I now switch from a tab with fotos to a tab without them, or vice versa, it's important that I execute the command.

The question is more whether I need to execute cm_SrcAllFiles even on tab changes between tabs with the same view mode because of the * in front of the command. It tells me to execute the command on every directory change, not just when changing view modes. But then the per tab filters would always be reset...
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 10 b8] files types saved for tabs might get reset when going to a tab where Auto Switch Mode applies

Post by *petermad »

2ghisler(Author)

I also first thought that the asterisk in front of the cm_SrcAllFiles was the reason - but if I remove the asterisk the behavior is exactly the same as described in my initial post!!
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 10 b8] files types saved for tabs might get reset when going to a tab where Auto Switch Mode applies

Post by *ghisler(Author) »

No, the asterisk isn't the reason, please re-read my reply!
The command is executed because the view mode changes when you switch between the tabs.

What I write at the end is whether it should also be executed when you switch between tabs when the view mode doesn't change, but the directory changes. Then the * would instruct TC to execute the command.

But I seem to remember that the current implementation is a compromise.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 10 b8] files types saved for tabs might get reset when going to a tab where Auto Switch Mode applies

Post by *petermad »

2ghisler(Author)
For example, I have defined a view mode for thumbnails view for my photos folder. This has set the following command:
cm_100Percent 70|cm_50Percent

So the panel switches to 70% width when in the photos folder, and back to 50% width when in another folder. If I now switch from a tab with fotos to a tab without them, or vice versa, it's important that I execute the command.
I can see that excactly these commands and also cm_VerticalPanels needs to be executed because they affect the whole layout of the file panels, but otherwise I doubt that there are other commands that would need to be run again when reentering a tab...?
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 10 b8] files types saved for tabs might get reset when going to a tab where Auto Switch Mode applies

Post by *ghisler(Author) »

Unfortunately you can't know what people could put there, they could even use a mix of commands which do and others which don't need to be called on tab change.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 10 b8] files types saved for tabs might get reset when going to a tab where Auto Switch Mode applies

Post by *petermad »

That's right - it also occurred to me that all the cm_Vis* command would need to be rerun on tab change.

But can I suggest maybe a new modifier (-), to make it possible for the user to control whether a command should be run at tab change - so that: -cm_SrcAllFiles would mean to NOT execute the command at tab change. It should be possible to combine that with * like: -*cm_SrcAllFiles (and/or *-cm_SrcAllFiles) = execute at all directory changes, but not at tab changes.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 10 b8] files types saved for tabs might get reset when going to a tab where Auto Switch Mode applies

Post by *ghisler(Author) »

That sounds like a good solution, I will try to add it.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 10 b8] files types saved for tabs might get reset when going to a tab where Auto Switch Mode applies

Post by *petermad »

history.txt wrote:12.05.01 Added: View modes, Auto-run commands: Put '-' at the start of the command field to not execute commands on tab change, only on directory change (32/64)
Seems to almost solve the problem - except that the '-' does not have effect for commands behind '|' (commands to be run when a view mode is left)
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 10 b8] files types saved for tabs might get reset when going to a tab where Auto Switch Mode applies

Post by *ghisler(Author) »

Unfortunately it's not possible to disable the commands behind '|' because they are from a different tab than the one you disabled in the front. Maybe I should allow a separate '-' behind the '|' sign?
Author of Total Commander
https://www.ghisler.com
Post Reply