- fix: can't parse old c-style enum variable definition like "enum Test test;"

This commit is contained in:
royqh1979@gmail.com 2021-11-01 23:29:03 +08:00
parent 1b9fdd3020
commit d27f8c1c50
3 changed files with 12 additions and 5 deletions

View File

@ -1,5 +1,7 @@
Version 0.7.7 Version 0.7.7
- change: "save" action will be enabled no matter contents in the current editor is modified or not - change: "save" action will be enabled no matter contents in the current editor is modified or not
- fix: focus not correctly set when the current editor is closed
- fix: can't parse old c-style enum variable definition like "enum Test test;"
Version 0.7.6 Version 0.7.6
- change: don't auto insert a new line when input an enter between '(' and ')' or between '[' and ']' (indent instead) - change: don't auto insert a new line when input an enter between '(' and ')' or between '[' and ']' (indent instead)

View File

@ -134,9 +134,9 @@ bool EditorList::closeEditor(Editor* editor, bool transferFocus, bool force) {
this->endUpdate(); this->endUpdate();
}); });
if (transferFocus && (editor->pageControl()->currentWidget()==editor)) { // if (transferFocus && (editor->pageControl()->currentWidget()==editor)) {
//todo: activate & focus the previous editor // //todo: activate & focus the previous editor
} // }
if (editor->inProject() && pMainWindow->project()) { if (editor->inProject() && pMainWindow->project()) {
int projIndex = pMainWindow->project()->indexInUnits(editor); int projIndex = pMainWindow->project()->indexInUnits(editor);
@ -152,7 +152,8 @@ bool EditorList::closeEditor(Editor* editor, bool transferFocus, bool force) {
updateLayout(); updateLayout();
if (!force) { if (!force) {
editor = getEditor(); editor = getEditor();
pMainWindow->updateClassBrowserForEditor(editor); editor->activate();
//pMainWindow->updateClassBrowserForEditor(editor);
} }
if (pageCount()==0) { if (pageCount()==0) {
pMainWindow->updateAppTitle(); pMainWindow->updateAppTitle();

View File

@ -1775,7 +1775,7 @@ void CppParser::handleEnum()
if (!mTokenizer[i + 1]->text.startsWith(';')) if (!mTokenizer[i + 1]->text.startsWith(';'))
enumName = mTokenizer[i + 1]->text.trimmed(); enumName = mTokenizer[i + 1]->text.trimmed();
} }
} else { // enum NAME {...}; } else if (mIndex+1< mTokenizer.tokenCount() && mTokenizer[mIndex+1]->text.startsWith('{')){ // enum NAME {...};
if ( (mIndex< mTokenizer.tokenCount()) && mTokenizer[mIndex]->text == "class") { if ( (mIndex< mTokenizer.tokenCount()) && mTokenizer[mIndex]->text == "class") {
//enum class {...} NAME //enum class {...} NAME
isEnumClass = true; isEnumClass = true;
@ -1791,6 +1791,10 @@ void CppParser::handleEnum()
// An opening brace must be present after NAME // An opening brace must be present after NAME
if ((mIndex >= mTokenizer.tokenCount()) || !mTokenizer[mIndex]->text.startsWith('{')) if ((mIndex >= mTokenizer.tokenCount()) || !mTokenizer[mIndex]->text.startsWith('{'))
return; return;
} else {
// enum NAME blahblah
// it's an old c-style enum variable definition
return;
} }
// Add statement for enum name too // Add statement for enum name too