From 6e4afe83c099b5e0644f8ab63d361f254136b6b3 Mon Sep 17 00:00:00 2001 From: royqh1979 Date: Sat, 6 Nov 2021 23:21:52 +0800 Subject: [PATCH] - fix: one line 'while' statement dosen't correctly indents - fix: line starts with '{' that follow an un-ended 'if'/'for' statement is not correctly un-indented --- NEWS.md | 2 ++ RedPandaIDE/qsynedit/SynEdit.cpp | 2 +- RedPandaIDE/qsynedit/highlighter/cpp.cpp | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index d128c80d..0eac45ce 100644 --- a/NEWS.md +++ b/NEWS.md @@ -10,6 +10,8 @@ Version 0.8.1 For Dev-C++ 7 Beta - fix: if the proceeding line ends with ':' in comments, current line should not indent - enhancement: right click the problem set name label to rename it - change: memory view and locals view use debug console's font settings + - fix: one line 'while' statement dosen't correctly indents + - fix: line start with '{' that follow an un-ended 'if'/'for' statement is not correctly un-indented Version 0.8 For Dev-C++ 7 Beta - fix: find in the current file is not correcly saved in the search history diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index 1d5d2389..7c04b962 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -1440,7 +1440,7 @@ int SynEdit::calcIndentSpaces(int line, const QString& lineText, bool addIndent) QVector matchingIndents; int l; if (attr == mHighlighter->symbolAttribute() - && firstToken == '}' ) { + && (firstToken == '}' || firstToken == '{')) { matchingIndents = rangeAfterFirstToken.matchingIndents; dontAddIndent = true; l = startLine; diff --git a/RedPandaIDE/qsynedit/highlighter/cpp.cpp b/RedPandaIDE/qsynedit/highlighter/cpp.cpp index 187d3654..2f96ce7e 100644 --- a/RedPandaIDE/qsynedit/highlighter/cpp.cpp +++ b/RedPandaIDE/qsynedit/highlighter/cpp.cpp @@ -8,7 +8,8 @@ static const QSet StatementKeyWords { "for", "try", "catch", - "else" + "else", + "while" };