From dd5ce57608e68b89a6c184690240a0f2d22a74c1 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sun, 13 Mar 2022 18:31:05 +0800 Subject: [PATCH] - enhancement: disable "code completion" will disable enhanced syntax highlight --- NEWS.md | 1 + RedPandaIDE/editor.cpp | 8 ++++++-- RedPandaIDE/qsynedit/SynEdit.cpp | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 780f51ba..7ff1c76f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -13,6 +13,7 @@ Red Panda C++ Version 1.0.0 - fix: wrong selection when drag & dropped in editor - enhancement: toggle block comment - fix: syntax color of #include header filenames not correct + - enhancement: disable "code completion" will disable enhanced syntax highlight Red Panda C++ Version 0.14.5 - fix: the "gnu c++ 20" option in compiler set options is wrong diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index eed64fa7..a9f4f372 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -886,7 +886,7 @@ void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &to if (token.isEmpty()) return; - if (mParser && highlighter() && (attr == highlighter()->identifierAttribute()) + if (mParser && mParser->enabled() && highlighter() && (attr == highlighter()->identifierAttribute()) && !mParser->isIncludeLine(lines()->getString(line-1)) ) { BufferCoord p{aChar,line}; @@ -2439,7 +2439,9 @@ void Editor::initParser() &EditorList::getContentFromOpenedEditor,pMainWindow->editorList(), std::placeholders::_1, std::placeholders::_2)); resetCppParser(mParser); - mParser->setEnabled((highlighter() && highlighter()->getClass() == SynHighlighterClass::CppHighlighter)); + mParser->setEnabled( + pSettings->codeCompletion().enabled() && + (highlighter() && highlighter()->getClass() == SynHighlighterClass::CppHighlighter)); } Editor::QuoteStatus Editor::getQuoteStatus() @@ -2570,6 +2572,8 @@ void Editor::reparse() if (highlighter()->language() != SynHighlighterLanguage::Cpp && highlighter()->language() != SynHighlighterLanguage::GLSL) return; + if (mParser) + mParser->setEnabled(pSettings->codeCompletion().enabled()); parseFile(mParser,mFilename,mInProject); } diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index e83a4075..26eac580 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -5698,6 +5698,8 @@ void SynEdit::ExecuteCommand(SynEditorCommand Command, QChar AChar, void *pData) case SynEditorCommand::ecScrollDown: verticalScrollBar()->setValue(verticalScrollBar()->value()+mMouseWheelScrollSpeed); break; + case SynEditorCommand::ecMatchBracket: + break; default: break; }