- change: Don't auto add; when completing '{' for lines starting with 'struct/union/enum' and ending with ')'

This commit is contained in:
Roy Qu 2023-11-19 17:15:17 +08:00
parent a6b9d282cf
commit d75f550742
2 changed files with 8 additions and 6 deletions

View File

@ -29,7 +29,9 @@ Red Panda C++ Version 2.26
- fix: Line numbers for problem case input/output/expected texteditors are not vertically centered.
- enhancement: E-ink color scheme.
- fix: Use the system default encoding for input when running problem cases.
- change: Use qt.conf to set the font engine. User can use the windows default font engine by remove this file.
- change: Use qt.conf to use freetype font engine. User can use the windows default font engine by remove this file.
- fix: Click on the line begin may toggle breakpoint.
- change: Don't auto add; when completing '{' for lines starting with 'struct/union/enum' and ending with ')'
Red Panda C++ Version 2.25

View File

@ -1360,7 +1360,7 @@ void Editor::mouseReleaseEvent(QMouseEvent *event)
// if ctrl+clicked
if ((event->modifiers() == Qt::ControlModifier)
&& (event->button() == Qt::LeftButton)) {
if (!selAvail() && mHoverModifiedLine != -1) {
if (!selAvail() ) {
QSynedit::BufferCoord p;
if (mParser && pointToCharLine(event->pos(),p)) {
cancelHoverLink();
@ -2766,7 +2766,7 @@ bool Editor::handleBraceCompletion()
QString s = lineText().trimmed();
int i= caretY()-2;
while ((s.isEmpty()) && (i>=0)) {
s=document()->getLine(i);
s=document()->getLine(i).trimmed();
i--;
}
QString text=selText();
@ -2781,13 +2781,13 @@ bool Editor::handleBraceCompletion()
processCommand(QSynedit::EditCommand::Char,'}');
if (
( (s.startsWith("struct")
( ( (s.startsWith("struct") && !s.endsWith(")"))
|| s.startsWith("class")
|| s.startsWith("union")
|| (s.startsWith("union") && !s.endsWith(")"))
|| s.startsWith("typedef")
|| s.startsWith("public")
|| s.startsWith("private")
|| s.startsWith("enum") )
|| (s.startsWith("enum") && !s.endsWith(")")) )
&& !s.contains(';')
) || s.endsWith('=')) {
processCommand(QSynedit::EditCommand::Char,';');