Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Wrong spell checker on russian (and probably other languages)

<< < (8/10) > >>

oBFusCATed:

--- Code: ---                EditorColourSet* colour_set = Manager::Get()->GetEditorManager()->GetColourSet();
                if (!colour_set)
                    break;
                wxString lang = colour_set->GetLanguageName(ctrl->GetLanguage() );
--- End code ---
Why is this code executed in a loop?

HasStyleToBeChecked also looks expensive. I'd rather change it to use unordered_set<struct{wxstring lang, int style}> instead of a map containing a set...

BlueHazzard:

--- Quote ---I don't really understand what it does...  :o
It would be good if you either add a comment explaining it or even better make it simpler and more clear.
--- End quote ---
It does what you suggested :) looking if we are moving, and if not increase the position future and future with increasing steps, so we get not stuck in a position, where word end is before the next valid word beginning. It is only a draft. I will make a commented patch...


--- Quote ---Why is this code executed in a loop?
--- End quote ---
Have not looked into this part of code...

oBFusCATed:

--- Quote from: BlueHazzard on November 08, 2019, 11:15:10 am ---It does what you suggested :)

--- End quote ---
I've not suggested writing it in such a way. :)

oBFusCATed:
I see you've committed it. I've read the comment multiple times and I've read the code multiple times and I still don't know why you've written it in such a convoluted way.

So, as far as I understand it the case which breaks the previous code is if pos is pointing between the to eol characters and wordstart/wordend point to an empty word. But then why don't you detect this case and just move pos by one and repeat the loop? Why are two new variables needed? Is there a case where posToAdd is bigger than 1 really? Another test which might work is if pos==wordend then you move pos by 1.

BlueHazzard:

--- Quote --- Is there a case where posToAdd is bigger than 1 really?
--- End quote ---
One case i can imagine: "\r\n\n" in this jumping one position is not enough, you have to jump at least 3 positions: wordstart and wordend will always point to \r for this word, independent where the input points to (0, 1 or 2)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version