Author Topic: extension problem  (Read 5922 times)

Offline liuyg

  • Multiple posting newcomer
  • *
  • Posts: 12
extension problem
« on: September 08, 2005, 10:40:13 am »
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.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: extension problem
« Reply #1 on: September 08, 2005, 11:09:22 am »
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:

Code
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 ;)
« Last Edit: September 08, 2005, 11:11:12 am by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline liuyg

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: extension problem
« Reply #2 on: September 09, 2005, 09:04:39 am »
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.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: extension problem
« Reply #3 on: September 09, 2005, 05:07:49 pm »
done
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: extension problem
« Reply #4 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.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: extension problem
« Reply #5 on: September 11, 2005, 12:20:30 pm »
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."

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: extension problem
« Reply #6 on: September 11, 2005, 03:29:28 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)

Even easier then :)
You already fixed it, I guess?
Already fixed ;)
Be patient!
This bug will be fixed soon...