Author Topic: Problem with comments  (Read 9983 times)

Offline Lqwertz80

  • Single posting newcomer
  • *
  • Posts: 7
Problem with comments
« on: March 23, 2013, 02:38:46 am »
Hi,
Sorry, I do not speak very good english!
Who can help me?
I have the latest version C::B 12.11 installed, everything is ok to compile my projects in C and C++.
But all comments and "char string" are highlighted in red. I've see if it's possible disable an option but I do not found.
It's really not pleasant to work in editor with this.
I hope my question is understandable.

Thank you in advance.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Problem with comments
« Reply #1 on: March 23, 2013, 03:46:51 am »
Yes, disable the spellcheck plugin or install some dictionaries.

http://wiki.codeblocks.org/index.php?title=SpellChecker_plugin

@dev:
1. Probably we should do something about this problem?
2. Disable spellcheck by default?
3. Provide dictionaries?
4. Don't highlight anything if there is no dictionary?

It seems that 4 is the best option...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Problem with comments
« Reply #2 on: March 23, 2013, 04:00:03 am »
Click in the bottom right hand corner (on the flag), then select a language.

@dev:
1. Probably we should do something about this problem?
2. Disable spellcheck by default?
3. Provide dictionaries?
4. Don't highlight anything if there is no dictionary?
The functioning in the trunk is better than in 12.11; in 12.11, if there are no dictionaries, spellcheck automatically disables itself.  Unfortunately, if it does find dictionaries, but none of them are its default language, it will enable on an invalid dictionary.
In the trunk, it selects the user specified dictionary, if available, otherwise the system local, if available, otherwise the first valid dictionary, otherwise disable.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Problem with comments
« Reply #3 on: March 23, 2013, 04:36:13 am »
The functioning in the trunk is better than in 12.11; in 12.11, if there are no dictionaries, spellcheck automatically disables itself.  Unfortunately, if it does find dictionaries, but none of them are its default language, it will enable on an invalid dictionary.
How can it find dictionaries on Windows without the help of the users? As most reports are from Windows users if I recall right.

In the trunk, it selects the user specified dictionary, if available, otherwise the system local, if available, otherwise the first valid dictionary, otherwise disable.
I think we should remove this "first valid dictionary". Even using the system's local is dangerous. It should default to English most probably, because most code is written in English.
And after we switch it to English if there are reports, we should just disable it by default and be done with it :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Problem with comments
« Reply #4 on: March 23, 2013, 04:00:36 pm »
How can it find dictionaries on Windows without the help of the users?
Magic ;) .
... actually, it guesses a few likely locations:
src/plugins/contrib/SpellChecker/SpellCheckerConfig.cpp
Code
const wxString SpellCheckerConfig::GetDictionaryPath()const
{
    wxArrayString dictPaths;
    dictPaths.Add(m_DictPath);
    Manager::Get()->GetMacrosManager()->ReplaceEnvVars(dictPaths[0]);
    if (platform::windows)
    {
        wxString programs = wxT("C:\\Program Files");
        wxGetEnv(wxT("ProgramFiles"), &programs);
        dictPaths.Add(programs + wxT("\\Mozilla Firefox\\dictionaries"));
        dictPaths.Add(programs + wxT("\\Mozilla\\Firefox\\dictionaries"));
        dictPaths.Add(programs + wxT("\\Mozilla Thunderbird\\dictionaries"));
        dictPaths.Add(programs + wxT("\\Mozilla\\Thunderbird\\dictionaries"));
        wxString libreOffice = wxFindFirstFile(programs + wxT("\\*LibreOffice*"), wxDIR);
        wxString openOffice = wxFindFirstFile(programs + wxT("\\*OpenOffice*"), wxDIR);
        wxArrayString langs = GetArrayFromString(wxT("en;fr;es;de"));
        for (size_t i = 0; i < langs.GetCount(); ++i)
        {
            if (!libreOffice.IsEmpty())
                dictPaths.Add(libreOffice + wxT("\\share\\extensions\\dict-") + langs[i]);
            if (!openOffice.IsEmpty())
                dictPaths.Add(openOffice + wxT("\\share\\extensions\\dict-") + langs[i]);
        }
    }
    else
    {
        dictPaths.Add(wxT("/usr/share/hunspell"));
        dictPaths.Add(wxT("/usr/share/myspell/dicts"));
    }
    dictPaths.Add(m_pPlugin->GetOnlineCheckerConfigPath());
    for (size_t i = 0; i < dictPaths.GetCount(); ++i)
    {
        if (wxDirExists(dictPaths[i]) && !wxFindFirstFile(dictPaths[i] + wxFILE_SEP_PATH + wxT("*.dic"), wxFILE).IsEmpty())
            return dictPaths[i];
    }
    return dictPaths[0];
}

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Problem with comments
« Reply #5 on: March 23, 2013, 04:21:20 pm »
How can it find dictionaries on Windows without the help of the users? As most reports are from Windows users if I recall right.

People should learn to read !!
If you start C::B with an unconfigured spellchecker-plugin you get an annoying dialog telling you, that you need dictionaries, with a link to the appropriate wiki-site: http://wiki.codeblocks.org/index.php?title=SpellChecker_plugin .

Most people tend to close such dialogs immediately, because they are used to try to work without reading manuals (and similar) and bother others instead.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Problem with comments
« Reply #6 on: March 23, 2013, 04:43:22 pm »
I think we should remove this "first valid dictionary". Even using the system's local is dangerous. It should default to English most probably, because most code is written in English.
I will write up a patch, but which English:
Code
    m_LanguageNamesMap[_T("en")]    = _T("English");
    m_LanguageNamesMap[_T("en_AU")] = _T("English (Australia)");
    m_LanguageNamesMap[_T("en_CA")] = _T("English (Canada)");
    m_LanguageNamesMap[_T("en_GB")] = _T("English (United Kingdom)");
    m_LanguageNamesMap[_T("en_NZ")] = _T("English (New Zealand)");
    m_LanguageNamesMap[_T("en_US")] = _T("English (United States)");
    m_LanguageNamesMap[_T("en_ZA")] = _T("English (South Africa)");

If you start C::B with an unconfigured spellchecker-plugin you get an annoying dialog telling you, that you need dictionaries, with a link to the appropriate wiki-site: http://wiki.codeblocks.org/index.php?title=SpellChecker_plugin .
I am not certain, but I think this dialog might fail to show up if a dictionary location is correctly guessed; I will be switching this to always show up on first run.

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Problem with comments
« Reply #7 on: March 23, 2013, 05:08:38 pm »
Yes, disable the spellcheck plugin or install some dictionaries.

http://wiki.codeblocks.org/index.php?title=SpellChecker_plugin

@dev:
1. Probably we should do something about this problem?
2. Disable spellcheck by default?
3. Provide dictionaries?
4. Don't highlight anything if there is no dictionary?

It seems that 4 is the best option...

Disable this plugin by default. Those who need it will enable it. It is unnecessary to force it to users.
Be a part of the solution, not a part of the problem.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Problem with comments
« Reply #8 on: March 23, 2013, 07:37:11 pm »
Attached is my recommended solution.

Offline ptDev

  • Almost regular
  • **
  • Posts: 222
Re: Problem with comments
« Reply #9 on: March 23, 2013, 07:53:38 pm »
In my installer, I modified SpellChecker so that US English is the default. I also make the installation of en-US compulsory if SpellChecker happens to be installed.

This avoids the aforementioned problems.
« Last Edit: March 24, 2013, 02:33:42 am by ptDev »

Offline Lqwertz80

  • Single posting newcomer
  • *
  • Posts: 7
Re: Problem with comments
« Reply #10 on: March 23, 2013, 09:54:02 pm »
Thank you for all your answers!
In first time I've disable dictionnary => Ok!
In seconde time I downloaded the correct dictionnary and any is correct.

Regards and thanks!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Problem with comments
« Reply #11 on: March 24, 2013, 11:26:19 pm »
People should learn to read !!
Haven't you learned already that they won't do it. There is another new topic about the same thing.
Probably if we switch to a mailing list the thing will get better, but a forum is too easy to subscribe :)

How hard would it be to recreate the installer for windows with the spellchecker disabled by default?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Problem with comments
« Reply #12 on: March 25, 2013, 01:25:32 am »
How hard would it be to recreate the installer for windows with the spellchecker disabled by default?
I think it would be in our best interest to rebuild the windows installer (if that is not too much work), as it seems this problem has come up from multiple users.  The simplest change would be to just disable it.  I prefer the changes from my patch -> add an enable/disable indicator, insure it is only activated if a valid dictionary is selected, first run default: English (US).  (But of course I would prefer my changes ;), otherwise why would I write them?)
I guess it would be up to whoever repackages (assuming we do) as to what changes are made.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Problem with comments
« Reply #13 on: March 25, 2013, 09:16:47 am »
How hard would it be to recreate the installer for windows with the spellchecker disabled by default?
Another option is to put a big red message on the download page about the problem :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Problem with comments
« Reply #14 on: March 25, 2013, 02:59:47 pm »
Another option is to put a big red message on the download page about the problem :)
... And underline the message with a red squiggly line ;).