Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

Flood of wxEVT_SCI_MODIFIED and wxEVT_SCI_CHANGE messages

(1/2) > >>

ollydbg:
When loading a project, I see a lot of wxEVT_SCI_MODIFIED and wxEVT_SCI_CHANGE messages. (You can enable the TRACE of codecompletion.cpp to see them)

I just track down, and I see that: UpdateEditorSyntax(editor); (mostly in CodeCompletion::OnParserEnd()) will cause such message.

Can we avoid them? It's annoying.

MortenMacFly:

--- Quote from: ollydbg on July 18, 2013, 05:14:50 pm ---Can we avoid them? It's annoying.

--- End quote ---
I think not really. It iterates (only!) across the open editors to update the syntax highlighting. If you skip the call to UpdateEditorSyntax() or avoid the event the editors won'T be highlighted correctly. IIRC this is needed for the macro and keyword stuff.

The only thing is not to have too many editors open... :-)

ollydbg:
It looks like

--- Code: ---void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
--- End code ---

call


--- Code: --- void SetLevel(int line, int level) {
pAccess->SetLevel(line, level);
}

--- End code ---

in a loop, so a lot of wxEVT_SCI_MODIFIED was sent. :(

ollydbg:

--- Quote from: MortenMacFly on July 18, 2013, 05:28:06 pm ---
--- Quote from: ollydbg on July 18, 2013, 05:14:50 pm ---Can we avoid them? It's annoying.

--- End quote ---
I think not really. It iterates (only!) across the open editors to update the syntax highlighting. If you skip the call to UpdateEditorSyntax() or avoid the event the editors won'T be highlighted correctly. IIRC this is needed for the macro and keyword stuff.

The only thing is not to have too many editors open... :-)

--- End quote ---
I have just post an analysis result, and found the source of such annoying message. (even only one editor is opened, there are still many messages sent).

ollydbg:
I track down the source, and I see that the flood of wxEVT_SCI_MODIFIED of messages happen at two time.

1, when loading project files

--- Code: ---cbEditor* EditorManager::Open(LoaderBase* fileLdr, const wxString& filename, int /*pos*/, ProjectFile* data)
--- End code ---

Each line will be set a new level, and those messages will be sent for each lines

--- Code: ---int SCI_METHOD Document::SetLevel(int line, int level) {
int prev = static_cast<LineLevels *>(perLineData[ldLevels])->SetLevel(line, level, LinesTotal());
if (prev != level) {
DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER,
                  LineStart(line), 0, 0, 0, line);
mh.foldLevelNow = level;
mh.foldLevelPrev = prev;
NotifyModified(mh);
}
return prev;
}
--- End code ---

2, when parser done, in void CodeCompletion::OnParserEnd(wxCommandEvent& event)
The call statement

--- Code: ---UpdateEditorSyntax(editor);

--- End code ---
Some code style will change, so there is also some messages of wxEVT_SCI_MODIFIED.

Navigation

[0] Message Index

[#] Next page

Go to full version