MC and file highlighting (fwd)

X-Stranger xstranger at altlinux.ru
Mon Aug 22 14:04:08 UTC 2005


В сообщении от 22 Август 2005 18:31 Вы написали:
> Hello,
>
> On Mon, 22 Aug 2005, Pavel Tsekov wrote:
> > > 2) perhaps the big if ... else-if block in file_entry_color() should be
> > >    moved to is_file_type() .
> >
> > 	I don't think so.
>
> Why ?

This block determines a color of a file entry, then it placed in this 
function.

>
> > > 3) strcmp() is performed on the file extension and an entry from the
> > > file type extensions list. The code assumes that the file type
> > > extensions list should be lowercase but one can enter upper / mixed
> > > case extensions. In this case strcmp() fails.
> >
> > 	Just try to use MC with this patch and you will see, that it is all
> > right and nothing fails.
>
> I did and it doesn't work for me. In the dialog which is used to enter the
> file extensions replace 'bak' with 'Bak' . Create a file with extension
> Bak and see what happens. You convert the file extension of the file to
> lower case and then compare to the list. I would not bother to comment a
> patch if I had not took the time to review it.

Sorry, i just only tryed to create 2 files with `bak` and `Bak` extensions and 
it works :) You right and bug fixed by replacing strcmp() <-> strcasecmp().

> > > 5) it would be good if the list of file types is not hardcoded i.e.
> > >
> > >    Databases, Graphics, Multimedia, etc.
> > >
> > >    but user configurable. just a wish.
> > >
> > > I think this is enough for starters :)
> >
> > 	If you don't like this categories, you can name them such as "group #1",
> > "group #2", etc. But I think that this list of file types is usable for
> > all peoples ;)
>
> Well it is arguable. There are certainly benefits if the user could enter
> its own categories . I.e. not only the five categories that you have
> introduced.

7 categories :) I think your way will be not so simple as this one. It 
possible to name this categories "group #1",etc and keep them empty, then you 
give user feature to make it own groups of file extensions by simple way. 
User can enter extensions list, but can keep it empty. Depending on this you 
can do 1 group, 2 groups or no groups at all.  If you want it, I will fix my 
patch.

Patch attached.

Regards, X-Stranger

-- 
В принципе можно сделать все.  На практике интересно то, что уже
есть.
		-- mike in devel@
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mc-4.6.1-file-highlight.patch.bz2
Type: application/x-bzip2
Size: 5349 bytes
Desc: not available
URL: <http://lists.midnight-commander.org/pipermail/mc-devel/attachments/20050822/ddb07942/attachment.bz2>


More information about the mc-devel mailing list