## Only search in selected directories/files TC9.5ß13

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: sheep, Hacker, Stefan2, white

mp
Junior Member
Posts: 23
Joined: 2010-10-21, 13:55 UTC

### Only search in selected directories/files TC9.5ß13

Hello,

I found a little bug or at least inconsistency.

When I start a search in a separater process, to search only in selected directories and files, the option "Search only in selected directories/files" is disabled, when I change the focus to another window, as described in the Total Commander Help. Okay so far.

When I search multiple times, that means not leaving the search dialog and clicking "Start search" multiple times, only for the first search the file is found. For further search operations the directory/file selection is lost, but the option "Search only in selected directories/files" is still available and checked. This should be disabled also after the first search when it is not possible to search for further files.

This behavior is the same for folders and archives.
For archives I can say it only works when "Search archives" is enabled automatically because it's saved.
When "Search archives" is set manually without leaving the Search dialog, the file selection is also lost. The "Search only in selected directories/files" option stays active.
Maybe it would be helpful to automatically set "Search archives" when archives are selected...

tuska
Power Member
Posts: 2065
Joined: 2007-05-21, 12:17 UTC

### Re: Only search in selected directories/files TC9.5ß13

mp wrote:When I search multiple times, that means not leaving the search dialog and clicking "Start search" multiple times,
only for the first search the file is found.
After the first search you should check "F2 Search in found files/folders"...

mp
Junior Member
Posts: 23
Joined: 2010-10-21, 13:55 UTC

### Re: Only search in selected directories/files TC9.5ß13

@tuska
Tank you for your reply, but this is not what I mean. It's not about searching in the previous results, but searching again for another search term, e.g. another file

tuska
Power Member
Posts: 2065
Joined: 2007-05-21, 12:17 UTC

### Re: Only search in selected directories/files TC9.5ß13

mp wrote:For further search operations the directory/file selection is lost,
but the option "Search only in selected directories/files" is still available and checked.
This should be disabled also after the first search when it is not possible to search for further files.

... It's not about searching in the previous results, but searching again for another search term, e.g. another file ...
I see.

I would not disable "Only search in selected directories/files" if it is checked,
because you have started the search query e.g. with marked folders.

In my opinion, however, it should be possible after clicking on the button "New search", "Start search",
to successfully perform a new search query for the marked folders (this is currently not possible).

But this question (button "New search") could also become a "question of faith"...

mp
Junior Member
Posts: 23
Joined: 2010-10-21, 13:55 UTC

### Re: Only search in selected directories/files TC9.5ß13

But when search dialog loses the focus, the "Search only in selected directories/files" option is also automatically disabled, because the selection could change until the focus comes back to the search dialog. For me this is the same thing.
If it is not possible to search in the selected files multiple times, the option should be disabled.
If changing the search options disturbs the search in selected files function, the option should be disabled.

ghisler(Author)
Posts: 39801
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

### Re: Only search in selected directories/files TC9.5ß13

Could someone check this again with RC1, please? It should behave like this:
1. When search dialog loses the focus, the "Search only in selected directories/files" option is also automatically disabled. This is unchanged.
2. When you start a search without going away from the dialog first, then further searches with option "Search only in selected directories/files" should now still work, even when going away from the dialog _after_ the first search.
Author of Total Commander
http://www.ghisler.com

Ovg
Power Member
Posts: 647
Joined: 2014-01-06, 16:26 UTC
Location: MOW

### Re: Only search in selected directories/files TC9.5ß13

2ghisler(Author)

For me working as you described.

One question: it is impossible to change directories between subsequental searches.
Search occurs only in the directories selected at first time.
Is it intended?
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 9.51 x64, Windows 7 SP1 x64

ghisler(Author)
Posts: 39801
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

### Re: Only search in selected directories/files TC9.5ß13

Thanks for confirming the fix!

You need to uncheck "Search only in selected directories/files" to change directories. Why? The selection is from that directory. Other directories most probably don't contain the same files, so changing the start directory with "Search only in selected directories/files" would lead to unexpected results.
Author of Total Commander
http://www.ghisler.com

Ovg
Power Member
Posts: 647
Joined: 2014-01-06, 16:26 UTC
Location: MOW

### Re: Only search in selected directories/files TC9.5ß13

2ghisler(Author)
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 9.51 x64, Windows 7 SP1 x64

tuska
Power Member
Posts: 2065
Joined: 2007-05-21, 12:17 UTC

### Re: Only search in selected directories/files TC9.5ß13

I can also confirm the fix

Here are my test results:
Search in selected directories/files only
Show

Code: Select all

Note:
The TC parameters -> ed: and ev: are not supported in "Only search in selected directories/files"!
In such cases, an error message is displayed.

1. Mark files, e.g. 5 files | Mark folders, e.g. 3 folders
2. Search in separate Process... Alt+Shift+F7
3. ALT+TAB -> Switch to another task and then press ALT+TAB again to return to the "Find Files" window:
Result: "Only search in selected directories/files" is unchecked! ...
Help-F1: Note: When using "Search in separate process" (Alt+Shift+F7), this option gets disabled when you switch away
from the search dialog to any other window (because the selection could be changed by that).
4. Click the "Cancel" button!
5. Search in separate Process... Alt+Shift+F7
6. Enter search word
7. Start search
8. Search result exists
9. ALT+TAB -> Switch to another task and then press ALT+TAB again to return to the "Find Files" window:
Result: "Only search in selected directories/files" remains checked!
10. Click the "Start search" button: The same search result is displayed
11. "F2 Search in found files/folders": Press F2 or click this menu item
Result: "Only search in selected directories/files" is unchecked immediately!
12. Enter new search word
Result:
- A new search word may be found
- It is possible to scroll with the arrow keys "<" and ">"
13. Click on the button "New search"
Result:
- The last search word entered is retained
- "Only search in selected directories/files" is not checked, even though the files are still selected.
This is fine because a new search has started.
- The search for a new search term may be successful
14. Close the "Find files" window (with ESC or click on "X")
15. Remove marking for files or folders with Ctrl + Num-


Search in selected archives only (e.g. * .zip, * .rar, etc.)
Show

Code: Select all

Notes:
- Each search query in an archive file is basically treated as a new search query.
- "F2 Search in found files/folders" can be used in a supporting way - see: point 12.
- The TC parameters -> ed: and ev: are not supported in "Only search in selected directories/files"!
In such cases, an error message is displayed.

Example with the following two test files:

Path\to\Test.zip	Path\to\Test1.zip
------------------------------------------
|- ACCESS_XP.mdb	|- Excel_XP.xls
|- DVD_XP.doc		|- Project_XP.mdb
|- DVD_XP_2000.mdb



Code: Select all

 1. Mark ZIP archives, e.g. 2 archives
Note: If the cursor is on a .ZIP file/selected .ZIP files and the search is started with ALT+Shift+F7,
then "Search archives (all except for UC2)" is *usually* checked automatically and a yellow callsign is displayed.
This setting may have to be changed manually [before the next search query].
2. Search in separate Process... Alt+Shift+F7
3. ALT+TAB -> Switch to another task and then press ALT+TAB again to return to the "Find Files" window:
Result: "Only search in selected directories/files" is unchecked!
Help-F1: Note: When using "Search in separate process" (Alt+Shift+F7), this option gets disabled when you switch away
from the search dialog to any other window (because the selection could be changed by that).
4. Click the "Cancel" button!
5. Search in separate Process... Alt+Shift+F7
6. Enter search word: xp
7. Check "Search archives (all except UC2)", if not already checked - see point 1. Note...
8. Start search
9. Search result exists (5 files)
10. ALT+TAB -> Switch to another task and then press ALT+TAB again to return to the "Find Files" window:
Result:
- "Only search in selected directories/files" remains checked!
- "Search archives (all except UC2)" remains checked!
11. Click the "Start search" button: The same search result is displayed



Code: Select all

12. "F2 Search in found files/folders": Not selectable, as it is greyed out -
searching in search results of an archive file is still possible(!), but not always restrictive,
i.e. a new or previously entered search word - which is currently not in the search results -
is interpreted like a new search in the selected ZIP archives! See also points up from 12g...
This means that each search query in an archive file is treated like a new search query.
12a ("F2") - Enter 1st search word: dvd
12a Leave settings unchanged
- "Only search in selected directories/files"
- "Search archives (all except for UC2)"
12b Start search
12c Search result (filtered) exists (2 files)
Result:
- New search word is found and the search result has been filtered
- It is possible to scroll with the arrow keys "<" and ">"
- [Multiple] ALT+TAB in the TC window and back *usually* automatically removes the marking from the 2 ZIP archives
12d ("F2") - Enter 2nd search word: 20
12d Leave settings unchanged
- "Only search in selected directories/files"
- "Search archives (all except for UC2)"
12e Start search
12f Search result (filtered) exists (1 file)
Result:
- New search word is found and the search result has been filtered
- It is possible to scroll with the arrow keys "<" and ">"
- [ALT+TAB in the TC window and back automatically removes the marking from the 2 ZIP archives - see point 12c!]
12g ("F2") - Enter 3rd search word: xp ... see also: points 6. + 9. ... this was also the first search word (without "F2")!
[Search word: xp; ("F2"): dvd, 20, xp]
12g Leave settings unchanged
- "Only search in selected directories/files"
- "Search archives (all except for UC2)"
- 2 ZIP archives in a TC window already WITHOUT marking
- Search result (filtered) exists (1 file)
12h Start search
12i Search result exists (5 files - see also: point 6. + 9.!)
Result:
- A "new" or, in this case, previously entered search word is found [again] if necessary and
the search result is displayed (in this case the content of 2 ZIP files, that is a total of 5 files)
- Scrolling with the arrow keys "<" and ">" is still possible as the search window is still open...



Code: Select all

13. Click on button "New search"
Result:
- "Only search in selected directories/files" remains checked (-> change if necessary... <-) - even after ALT+TAB,...
- "Search archives (all except for UC2)" remains checked .... (-> change if necessary... <-) - even after ALT+TAB,...
- The last search word entered is retained
- The search for a new keyword: Access ... is possible/successful
!! Although "F2 Search in found files/folders" is grayed out and cannot be clicked		  !!
!! a search in the search result of an archive file is possible in a certain way! - See: point 12!  !!
14. Close the "Find files" window (with ESC or click on "X")
15: Remove marking for files/folders with Ctrl+Num- -> Omitted because the marking has already been removed automatically (pt. 12c)



Windows 10 Pro (x64) Version 1909 (OS build 18363.592)
TC 9.50rc1 x64/x86

PS:
The test results were incorporated into this documentations:
TC <-> Everything (German) ....: https://ghisler.ch/board/viewtopic.php?f=2&t=56799
TC <-> Everything (English) .....: https://ghisler.ch/board/viewtopic.php?f=3&t=56800

mp
Junior Member
Posts: 23
Joined: 2010-10-21, 13:55 UTC

### Re: Only search in selected directories/files TC9.5ß13

Thank you very much.

I too can confirm this fixed, but I would like to take up the archives thing again.

When I select a 7z file and initiate a "Search only in selected directories/files", wouldn't it be nice to automatically select the "Search archives" option?

When this option isn't automatically enabled, one could oversee that there has been an archive within the selected files and possibly wouldn't find a file, even it is in the archive.

When files/directories are selected, the "Search only in selected directories/files" is also automatically selected.

Maybe you could activate the yellow exclamation mark when this selection is enabled automatically...

tuska
Power Member
Posts: 2065
Joined: 2007-05-21, 12:17 UTC

### Re: Only search in selected directories/files TC9.5ß13

mp wrote:When I select a 7z file and initiate a "Search only in selected directories/files",
wouldn't it be nice to automatically select the "Search archives" option?
This is done in almost all cases (--> "... automatically select the "Search archives" option").

This is why I wrote under "Search in selected archives only (e.g. * .zip, * .rar, etc.) - Point 1."
Note:
If the cursor is on a .ZIP file/selected .ZIP files and the search is started with ALT+Shift+F7,
then "Search archives (all except for UC2)" is *usually* checked automatically and a yellow callsign is displayed.
This setting may have to be changed manually [before the next search query].
I could not find out until now why this automatic does not work in some rare cases.

mp
Junior Member
Posts: 23
Joined: 2010-10-21, 13:55 UTC

### Re: Only search in selected directories/files TC9.5ß13

2tuska I think the "Search archives" option is simply saved on the last search operation and restored on the next one...

tuska
Power Member
Posts: 2065
Joined: 2007-05-21, 12:17 UTC

### Re: Only search in selected directories/files TC9.5ß13

mp wrote:
2020-01-28, 14:28 UTC
I think the "Search archives" option is simply saved on the last search operation and restored on the next one...
Yeah, now that you mention it, I agree.

tuska
Power Member
Posts: 2065
Joined: 2007-05-21, 12:17 UTC

### Re: Only search in selected directories/files TC9.5ß13

tuska wrote:
2020-01-28, 14:38 UTC
mp wrote:
2020-01-28, 14:28 UTC
I think the "Search archives" option is simply saved on the last search operation and restored on the next one...
Yeah, now that you mention it, I agree.
@Author
Will there be any change here?