From 2ceb95e4cc0f0e5f1db3a3750b61c0075d293550 Mon Sep 17 00:00:00 2001 From: "royqh1979@gmail.com" Date: Wed, 27 Oct 2021 16:39:23 +0800 Subject: [PATCH] - fix: "tab to spaces" option in the editor general options widget doesn't work --- NEWS.md | 2 ++ RedPandaIDE/parser/cppparser.cpp | 5 +++-- RedPandaIDE/parser/cppparser.h | 1 + RedPandaIDE/qsynedit/SynEdit.cpp | 2 +- RedPandaIDE/settingsdialog/editorgeneralwidget.cpp | 4 ++-- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index a3f030c7..f8a7272e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ Version 0.7.4 - fix: when debug a project, and have breakpoints that not in opened editors, dev-cpp will crash + - fix: when a file is parsing in background, exit dev-cpp will crash + - fix: "tab to spaces" option in the editor general options widget doesn't work Version 0.7.3 - enhancement: icons in project view diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index f738fdf6..7a62c100 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -32,6 +32,7 @@ CppParser::CppParser(QObject *parent) : QObject(parent) mIsHeader = false; mIsProjectFile = false; + mCppKeywords = CppKeywords; //mNamespaces; //mBlockBeginSkips; //mBlockEndSkips; @@ -1289,7 +1290,7 @@ bool CppParser::checkForForBlock() bool CppParser::checkForKeyword() { - SkipType st = CppKeywords.value(mTokenizer[mIndex]->text,SkipType::skNone); + SkipType st = mCppKeywords.value(mTokenizer[mIndex]->text,SkipType::skNone); return st!=SkipType::skNone; } @@ -1960,7 +1961,7 @@ void CppParser::handleForBlock() void CppParser::handleKeyword() { // Skip - SkipType skipType = CppKeywords.value(mTokenizer[mIndex]->text,SkipType::skNone); + SkipType skipType = mCppKeywords.value(mTokenizer[mIndex]->text,SkipType::skNone); switch (skipType) { case SkipType::skItself: // skip it; diff --git a/RedPandaIDE/parser/cppparser.h b/RedPandaIDE/parser/cppparser.h index f2a0e1c4..fa73323c 100644 --- a/RedPandaIDE/parser/cppparser.h +++ b/RedPandaIDE/parser/cppparser.h @@ -369,6 +369,7 @@ private: QRecursiveMutex mMutex; GetFileStreamCallBack mOnGetFileStream; + QMap mCppKeywords; }; using PCppParser = std::shared_ptr; diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index 39e09353..8e74d48e 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -1987,7 +1987,7 @@ void SynEdit::insertLine(bool moveCaret) BackCounter--; } } - mLines->insert(mCaretY - 1, ""); + mLines->insert(mCaretY - 1, GetLeftSpacing(SpaceCount2,true)); nLinesInserted++; mUndoList->AddChange(SynChangeReason::crLineBreak, caretXY(), caretXY(), "", SynSelectionMode::smNormal); diff --git a/RedPandaIDE/settingsdialog/editorgeneralwidget.cpp b/RedPandaIDE/settingsdialog/editorgeneralwidget.cpp index 5bfbc9af..b7894ad9 100644 --- a/RedPandaIDE/settingsdialog/editorgeneralwidget.cpp +++ b/RedPandaIDE/settingsdialog/editorgeneralwidget.cpp @@ -40,7 +40,7 @@ void EditorGeneralWidget::doLoad() //indents ui->chkAddIndent->setChecked(pSettings->editor().addIndent()); ui->chkAutoIndent->setChecked(pSettings->editor().autoIndent()); - ui->chkTabToSpaces->setChecked(pSettings->editor().autoIndent()); + ui->chkTabToSpaces->setChecked(pSettings->editor().tabToSpaces()); ui->spTabWidth->setValue(pSettings->editor().tabWidth()); ui->chkShowIndentLines->setChecked(pSettings->editor().showIndentLines()); ui->colorIndentLine->setColor(pSettings->editor().indentLineColor()); @@ -72,7 +72,7 @@ void EditorGeneralWidget::doSave() //indents pSettings->editor().setAddIndent(ui->chkAddIndent->isChecked()); pSettings->editor().setAutoIndent(ui->chkAutoIndent->isChecked()); - pSettings->editor().setAutoIndent(ui->chkTabToSpaces->isChecked()); + pSettings->editor().setTabToSpaces(ui->chkTabToSpaces->isChecked()); pSettings->editor().setTabWidth(ui->spTabWidth->value()); pSettings->editor().setShowIndentLines(ui->chkShowIndentLines->isChecked()); pSettings->editor().setIndentLineColor(ui->colorIndentLine->color());