News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

extension problem

Started by liuyg, September 08, 2005, 10:40:13 AM

Previous topic - Next topic

liuyg

HI,

Another problem!  :D

I open MS SDK Sample file which extension is 'Cpp' with CB. But CB can't recognize it. No highlight, No source foler in project window.
All 'Cpp' file are in other folder.

thomas

#1
Hmm... was going to say that probably the lexer files are case sensitive, but that is not the case.


The guilty code pieces are in editorcolorset.cpp, lines 508-512:

void EditorColorSet::SetFileMasks(HighlightLanguage lang, const wxString& masks, const wxString& separator)
{
    if (lang != HL_NONE)
        m_Sets[lang].m_FileMasks = GetArrayFromString(masks.Lower(), separator);
}



and lines 265-277:

HighlightLanguage EditorColorSet::GetLanguageForFilename(const wxString& filename)
{
   // first search in filemasks
   for (int i = 0; i < HL_LAST; ++i)
   {
      for (unsigned int x = 0; x < m_Sets.m_FileMasks.GetCount(); ++x)
      {
         if (filename.Matches(m_Sets.m_FileMasks.Item(x)))
                return i;
      }
   }
    return HL_NONE;
}


wxString::Matches does clobbing, but is not case sensitive and is case sensitive (which is why it does not work).


Try replacing line 272 with:

if (filename.Lower().Matches(m_Sets[i].m_FileMasks.Item(x)))
and see if that works.
Then you may want to submit a bug report (or a patch) on SF so this is not forgotten ;)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

liuyg

OH, As you said, I find a bug!   :)

I am only a normal user of CB and have not time to study CB source. In fact, I have not downloaded CB source.  Can you submit a bug report to development team instead of me? This will make CB more perfect.
Thanks for your detail solution.

thomas

"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

rickg22

the function Matches has an optional parameter to say it whether it should use case-insensitive comparisons.

thomas

Even easier then :)
You already fixed it, I guess?
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

mandrav

Quote from: rickg22 on September 09, 2005, 08:01:24 PM
the function Matches has an optional parameter to say it whether it should use case-insensitive comparisons.
No, it doesnt (at least under wx2.4)

Quote from: thomas on September 11, 2005, 12:20:30 PM
Even easier then :)
You already fixed it, I guess?
Already fixed ;)
Be patient!
This bug will be fixed soon...