View Issue Details

IDProjectCategoryView StatusLast Update
0000748Double CommanderGraphical user interfacepublic2019-06-08 15:28
Reporterrandomize46 Assigned ToAlexx2000  
PrioritylowSeverityminorReproducibilityalways
Status closedResolutionfixed 
ProjectionnoneETAnone 
PlatformWindows 8, 64bit 
Product Version0.5.7Product Build5310M 
Target Version0.6.0Fixed in Version0.6.0 
Summary0000748: Files in panels have wrong coloring
DescriptionI tried to setup simple color scheme for different file types and got wrong result.

First of all directories are displayed in wrong random color from my palete, constant between launches, but changing while I reorder palette or add/remove items, sometimes it even doesn't match pattern (For exmpl. "*.html" color was chosen).

And definitely buggy example is shown in this screen(actually directories there are still wrong colored, but it is less obvious) where some mp3 files are colored correct and some - wrong. I doublechecked my wildcards.

http://storage6.static.itmages.ru/i/13/1025/h_1382655781_9307945_3f4592e5e1.png

PS. Another thing I noticed, it will be good(though not necessary) to have colors updating on "Apply" button hit.
Steps To Reproduce1) Setup color scheme
2) Check colors

If you tell me where color schemes are stored I can attach exactly my case for better reproduction.
TagsNo tags attached.
Fixed in Revision5721
Operating systemWindows
Widgetset
Architecture64-bit

Relationships

related to 0000977 closedAlexx2000 Coloring by file types fails when ".com" string exists in filename 

Activities

Alexx2000

2013-10-25 08:14

administrator   ~0001159

The color schemes are stored in doublecmd.xml in <FileFilters> section.

randomize46

2013-10-25 14:40

reporter   ~0001160

Today I checked with latest trunk, bug is still there.
I tried some debuggin in Lazarus 1.0.12 and found that function

   function MatchesMaskList(const FileName, Mask: String; Separator: Char): Boolean;
   from unit uMasks.pas:100

is called with arguments:
   FileNAme = 'my_file(www.site.com).mp3'
   Mask = '*.exe*;*.com*;*.pif*;*.bat*;*.scr*;*.lnk*;*.cmd*;*.dll*'
   Separator = ';'

And obviously returns True because *.com* matches, the function itself works fine.

The problem is why does mask look like this?
In xml settings and in UI it is defined and displayed as:
   '*.exe;*.com;*.pif;*.bat;*.scr;*.lnk;*.cmd;*.dll'

Those additional '*' sumbols lead to wrong match.
mp3 files I showed in screenshot are colored red because they contain
".com" in name, but it is not expected behavior I guess.

It is happening here at ufindfiles.pas:134
    iMask:= Length(sMask);
...
    if sMask[iMask] <> '*' then sMask:= sMask + '*';



Finally the directory bug

here is ufindfiles.pas:307
function CheckDirectoryName(const FileChecks: TFindFileChecks; const DirectoryName: String): Boolean;
begin
  with FileChecks do
  begin
    Result := not MatchesMaskList(DirectoryName, ExcludeDirectories);
  end;
end;

So basically any directory don't even check for match with filename pattern, just matches anyway by default?
Only if blackisted with ExcludeDirectories the function will return False.
So if I have '>Archives' search filter colored red as first file type category, all directories will result red.

  
I had not dare to change the code, better leave it to author, actually I am not an experienced Pascal programmer and don't know project structure well.


So finally steps to reproduce with default settings:

  1) Go to Configuration->Options->File types
  2) Create new Category, define color A for search template '>A' (ex: '*.com')
  3) Create new Category define color B for search template '>B' (ex: '*.jpg')
  4) create a file 'file(www.site.com).jpg'

Bug1
expected: file has color B
got: file has color A

Bug2
expected: directories have default color
got: directories have color A


I guess my settings file is not required anymore.

Alexx2000

2013-10-29 09:07

administrator   ~0001161

>It is happening here at ufindfiles.pas:134
> iMask:= Length(sMask);
>...
> if sMask[iMask] <> '*' then sMask:= sMask + '*';

It is because IsPartialNameSearch option is active. Uncheck "Search for part of filename" when save search template if you don't want such behavior. See also my comment in this issue: http://doublecmd.sourceforge.net/mantisbt/view.php?id=670

randomize46

2013-10-29 18:43

reporter   ~0001162

Got it, thank you! Fixed my issue by manually editing of config.

Anyway, that global setting "Search for part of filename" by default affects all new search templates implicitly, maybe it is reasonable to have bPartialNameSearch checkbox in template definition window (actually little stripped version on fFindDialog as I see) visible and indicating that behavior? Is there any particular reason making that checkbox invisible I missed? (It hides by fFindDlg.pas:501)

Alexx2000

2015-01-02 16:48

administrator   ~0001356

Done

Issue History

Date Modified Username Field Change
2013-10-25 03:32 randomize46 New Issue
2013-10-25 08:14 Alexx2000 Note Added: 0001159
2013-10-25 08:14 Alexx2000 Status new => feedback
2013-10-25 14:40 randomize46 Note Added: 0001160
2013-10-25 14:40 randomize46 Status feedback => new
2013-10-29 09:07 Alexx2000 Note Added: 0001161
2013-10-29 09:07 Alexx2000 Status new => feedback
2013-10-29 18:43 randomize46 Note Added: 0001162
2013-10-29 18:43 randomize46 Status feedback => new
2015-01-02 16:47 Alexx2000 Relationship added related to 0000977
2015-01-02 16:48 Alexx2000 Fixed in Revision => 5721
2015-01-02 16:48 Alexx2000 Note Added: 0001356
2015-01-02 16:48 Alexx2000 Assigned To => Alexx2000
2015-01-02 16:48 Alexx2000 Status new => resolved
2015-01-02 16:48 Alexx2000 Resolution open => fixed
2015-01-02 16:48 Alexx2000 Fixed in Version => 0.6.0
2015-01-02 16:48 Alexx2000 Target Version => 0.6.0
2019-06-08 15:28 Alexx2000 Status resolved => closed