work save

This commit is contained in:
royqh1979@gmail.com 2021-08-27 00:49:50 +08:00
parent ddbd302af3
commit 6c8c100074
2 changed files with 19 additions and 13 deletions

View File

@ -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;

View File

@ -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,