From 10c134a5c71ebf4710f8276748fa3607b4a35921 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Wed, 23 Aug 2023 17:24:07 +0800 Subject: [PATCH] - change: Symbol completion of '(' won't test current character at the cursor. - change: Symbol completion of '{' won't insert extra new lines. --- NEWS.md | 5 +++++ RedPandaIDE/RedPandaIDE.pro | 2 +- RedPandaIDE/editor.cpp | 24 +++++++++++------------- Red_Panda_CPP.pro | 2 +- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/NEWS.md b/NEWS.md index b081983b..cbeb8ec2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +Red Panda C++ Version 2.25 + + - change: Symbol completion of '(' won't test current character at the cursor. + - change: Symbol completion of '{' won't insert extra new lines. + Red Panda C++ Version 2.24 - fix: members of elements of stl maps are not correctly suggested. diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro index d9fae4bc..e9093059 100644 --- a/RedPandaIDE/RedPandaIDE.pro +++ b/RedPandaIDE/RedPandaIDE.pro @@ -14,7 +14,7 @@ isEmpty(APP_NAME) { } isEmpty(APP_VERSION) { - APP_VERSION = 2.24 + APP_VERSION = 2.25 } contains(QMAKE_HOST.arch, x86_64):{ diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 7db5347f..6595a580 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -1014,23 +1014,23 @@ void Editor::keyPressEvent(QKeyEvent *event) case '}': case '[': case ']': - case '<': case '*': case ';': case ',': + case '(': handled = handleSymbolCompletion(ch); return; - case '(': { - QChar nextCh = nextNonSpaceChar(caretY()-1,caretX()-1); - if (!isIdentChar(nextCh) && nextCh!='(' - && nextCh!='"' && nextCh!='\'' ){ - handled = handleSymbolCompletion(ch); - } - return; - } +// QChar nextCh; +// if (selAvail()) { +// nextCh = nextNonSpaceChar(caretY()-1,caretX()-1); +// } else { +// nextCh = nextNonSpaceChar(caretY()-1,caretX()-1); +// } +// if (!isIdentChar(nextCh) && nextCh!='(' +// && nextCh!='"' && nextCh!='\'' ){ + case '<': case '>': - if ((caretX() <= 1) || lineText().isEmpty() - || lineText()[caretX() - 2] != '-') { + if (mParser) { handled = handleSymbolCompletion(ch); return; } @@ -2740,9 +2740,7 @@ bool Editor::handleBraceCompletion() if (text.isEmpty()) { oldCaret = caretXY(); } else { - processCommand(QSynedit::EditCommand::InsertLine); setSelText(text); - processCommand(QSynedit::EditCommand::InsertLine); } processCommand(QSynedit::EditCommand::Char,'}'); diff --git a/Red_Panda_CPP.pro b/Red_Panda_CPP.pro index f50e42a9..c7e6d357 100644 --- a/Red_Panda_CPP.pro +++ b/Red_Panda_CPP.pro @@ -14,7 +14,7 @@ qsynedit.subdir = libs/qsynedit APP_NAME = RedPandaCPP -APP_VERSION = 2.24 +APP_VERSION = 2.25 # Add the dependencies so that the RedPandaIDE project can add the depended programs # into the main app bundle