diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 0a278da0..be0947c0 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -531,12 +531,14 @@ bool Editor::onGetSpecialLineColors(int Line, QColor &foreground, QColor &backgr void Editor::copyToClipboard() { if (pSettings->editor().copySizeLimit()) { - if (lines()->count() > pSettings->editor().copyLineLimits()) { + int startLine = blockBegin().Line; + int endLine = blockEnd().Line; + if ((endLine-startLine+1) > pSettings->editor().copyLineLimits()) { QMessageBox::critical(pMainWindow,tr("Error"), tr("The text to be copied exceeds count limit!")); return; } - if (lines()->getTextLength() > pSettings->editor().copyCharLimits() * 1000) { + if ((selText().length()) > pSettings->editor().copyCharLimits() * 1000) { QMessageBox::critical(pMainWindow,tr("Error"), tr("The text to be copied exceeds character limit!")); return; diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index f3d70fb6..c1cfe6e6 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -1644,18 +1644,21 @@ void CppParser::handleEnum() bool isEnumClass = false; int startLine = mTokenizer[mIndex]->line; mIndex++; //skip 'enum' - if (mTokenizer[mIndex]->text.startsWith('{')) { // enum {...} NAME + + if (mIndex < mTokenizer.tokenCount() && mTokenizer[mIndex]->text == "class") { + //enum class + isEnumClass = true; + mIndex++; //skip class + + } + if ((mIndex< mTokenizer.tokenCount()) && mTokenizer[mIndex]->text.startsWith('{')) { // enum {...} NAME // Skip to the closing brace int i = skipBraces(mIndex); - if ((i + 1 < mTokenizer.tokenCount()) && mTokenizer[i]->text == "class") { - //enum class {...} NAME - isEnumClass = true; - i++; - } // Have we found the name? - if ((i + 1 < mTokenizer.tokenCount()) && !mTokenizer[i]->text.startsWith('}') - && !mTokenizer[i + 1]->text.startsWith(';')) - enumName = mTokenizer[i + 1]->text.trimmed(); + if ((i + 1 < mTokenizer.tokenCount()) && mTokenizer[i]->text.startsWith('}')) { + if (!mTokenizer[i + 1]->text.startsWith(';')) + enumName = mTokenizer[i + 1]->text.trimmed(); + } } else { // enum NAME {...}; if ( (mIndex< mTokenizer.tokenCount()) && mTokenizer[mIndex]->text == "class") { //enum class {...} NAME @@ -1708,6 +1711,8 @@ void CppParser::handleEnum() true, false); } + } else { + enumStatement = getCurrentScope(); } // Skip opening brace @@ -1913,7 +1918,6 @@ void CppParser::handleMethod(const QString &sType, const QString &sName, const Q int delimPos = sName.indexOf("::"); QString scopelessName; QString parentClassName; - PStatement functionClass; if (delimPos >= 0) { // Provide Bar instead of Foo::Bar scopelessName = sName.mid(delimPos); @@ -1973,7 +1977,7 @@ void CppParser::handleMethod(const QString &sType, const QString &sName, const Q } } else { functionStatement = addStatement( - getCurrentScope(), + functionClass, mCurrentFile, "", // do not override hint sType,