From 56cd6c4d76586748d41f71ba4cb82d8a9a8e06f0 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sat, 18 Mar 2023 21:37:11 +0800 Subject: [PATCH] - fix: The option "Minimal indent for a continuous conditional beloning to a conditional header:" for formatter is not correct. --- NEWS.md | 5 + RedPandaIDE/RedPandaIDE.pro | 2 +- .../settingsdialog/formattergeneralwidget.cpp | 10 +- .../settingsdialog/formattergeneralwidget.h | 2 + .../settingsdialog/formattergeneralwidget.ui | 5 +- RedPandaIDE/translations/RedPandaIDE_pt_BR.ts | 16 ++ RedPandaIDE/translations/RedPandaIDE_zh_CN.ts | 208 ++++++++++-------- RedPandaIDE/translations/RedPandaIDE_zh_TW.ts | 16 ++ Red_Panda_CPP.pro | 2 +- 9 files changed, 167 insertions(+), 99 deletions(-) diff --git a/NEWS.md b/NEWS.md index ca6c6bb8..742e6e90 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +Red Panda C++ Version 2.19 + + - fix: Crash when directive line ends with '\' and at the last line. + - fix: The option "Minimal indent for a continuous conditional beloning to a conditional header:" for formatter is not correct. + Red Panda C++ Version 2.18 - fix: macos icon size overgrown (by RigoLigo). diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro index 277d1e29..8c06bf85 100644 --- a/RedPandaIDE/RedPandaIDE.pro +++ b/RedPandaIDE/RedPandaIDE.pro @@ -8,7 +8,7 @@ isEmpty(APP_NAME) { } isEmpty(APP_VERSION) { - APP_VERSION = 2.18 + APP_VERSION = 2.19 } contains(QMAKE_HOST.arch, x86_64):{ diff --git a/RedPandaIDE/settingsdialog/formattergeneralwidget.cpp b/RedPandaIDE/settingsdialog/formattergeneralwidget.cpp index b2958556..0bb42b0b 100644 --- a/RedPandaIDE/settingsdialog/formattergeneralwidget.cpp +++ b/RedPandaIDE/settingsdialog/formattergeneralwidget.cpp @@ -29,6 +29,11 @@ FormatterGeneralWidget::FormatterGeneralWidget(const QString& name, const QStrin ui->editDemo->setReadOnly(true); connect(this, &SettingsWidget::settingsChanged, this, &FormatterGeneralWidget::updateDemo); + + ui->cbMinConditionalIndent->addItem(tr("No minimal indent"),0); + ui->cbMinConditionalIndent->addItem(tr("Indent at least one additional indent"),1); + ui->cbMinConditionalIndent->addItem(tr("Indent at least two additional indents"),2); + ui->cbMinConditionalIndent->addItem(tr("Indent at least one-half an additional indent."),3); } FormatterGeneralWidget::~FormatterGeneralWidget() @@ -77,7 +82,8 @@ void FormatterGeneralWidget::doLoad() ui->chkIndentPreprocCond->setChecked(format.indentPreprocCond()); ui->chkIndentPreprocDefine->setChecked(format.indentPreprocDefine()); ui->chkIndentCol1Comments->setChecked(format.indentCol1Comments()); - ui->spinMinConditionalIndent->setValue(format.minConditionalIndent()); + int index=ui->cbMinConditionalIndent->findData(format.minConditionalIndent()); + ui->cbMinConditionalIndent->setCurrentIndex(index); ui->spinMaxContinuationIndent->setValue(format.maxContinuationIndent()); ui->chkBreakBlocks->setChecked(format.breakBlocks()); ui->chkBreakBlocksAll->setChecked(format.breakBlocksAll()); @@ -363,7 +369,7 @@ void FormatterGeneralWidget::updateCodeFormatter(Settings::CodeFormatter &format format.setIndentPreprocCond(ui->chkIndentPreprocCond->isChecked()); format.setIndentPreprocDefine(ui->chkIndentPreprocDefine->isChecked()); format.setIndentCol1Comments(ui->chkIndentCol1Comments->isChecked()); - format.setMinConditionalIndent(ui->spinMinConditionalIndent->value()); + format.setMinConditionalIndent(ui->cbMinConditionalIndent->currentData().toInt()); format.setMaxContinuationIndent(ui->spinMaxContinuationIndent->value()); format.setBreakBlocks(ui->chkBreakBlocks->isChecked()); format.setBreakBlocksAll(ui->chkBreakBlocksAll->isChecked()); diff --git a/RedPandaIDE/settingsdialog/formattergeneralwidget.h b/RedPandaIDE/settingsdialog/formattergeneralwidget.h index ac68e05b..0f18efa2 100644 --- a/RedPandaIDE/settingsdialog/formattergeneralwidget.h +++ b/RedPandaIDE/settingsdialog/formattergeneralwidget.h @@ -75,6 +75,8 @@ private: protected: void doLoad() override; void doSave() override; + + // SettingsWidget interface }; #endif // FORMATTERGENERALWIDGET_H diff --git a/RedPandaIDE/settingsdialog/formattergeneralwidget.ui b/RedPandaIDE/settingsdialog/formattergeneralwidget.ui index 94143a8c..67f8ef88 100644 --- a/RedPandaIDE/settingsdialog/formattergeneralwidget.ui +++ b/RedPandaIDE/settingsdialog/formattergeneralwidget.ui @@ -296,7 +296,7 @@ - + @@ -341,6 +341,9 @@ 40 + + 120 + diff --git a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts index ebd8e6fe..beaf5985 100644 --- a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts +++ b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts @@ -2522,6 +2522,22 @@ Don't break multimple statements residing on one line + + No minimal indent + + + + Indent at least one additional indent + + + + Indent at least two additional indents + + + + Indent at least one-half an additional indent. + + FormatterPathWidget diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts index 45f2a27b..2b3ac54d 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts @@ -3151,150 +3151,150 @@ Are you really want to continue? 连续行的最大缩进空格数: - + Indentation 2 缩进2 - + Indent labels 缩进标签(label) - + Indent class blocks 缩进类定义(class) - + Indent namespaces 缩进命名空间定义(namespace) - + Indent class access modifiers 缩进类访问限制符('public','private'...) - + Indent after parenthesis '(' or assignment '=' 在括号'('或赋值号'='后缩进 - + Indent preprocessor conditional statements 缩进预处理条件指令('#if','#else',...) - + Indent multi-line preprocessor #define statements 缩进多行#define语句 - + Indent line comments that start in column one 缩进在第一列开始的行注释 - + Indent preprocessor blocks 缩进预处理代码段 - + Indent switch blocks 缩进switch语句 - + Indent cases 缩进case语句 - + Padding 1 填充1 - + Insert spaces around operators 在运算符周围插入空格 - + Insert spaces after commas 在逗号后插入空格 - + Insert spaces after parenthesis headers ('if','for',...) 在语句和括号间插入空格('if','for'...) - + Insert spaces around parenthesis on the outside only 在括号外侧加入空格 - + Insert spaces around parenthesis on the inside only 在括号内侧加入空格 - + Insert empty lines arround unrelated blocks 在代码段之间加入空行 - + Insert empty lines around all blocks Insert empy lines around all blocks 在所有代码段之间加入空行 - + Insert spaces around first parenthesis in a series on the out side only 在多层嵌套括号的最外侧加入空格 - + Insert spaces around parenthesis 在括号两侧加入空格 - + Padding 2 填充2 - + Remove all empty lines. It will NOT delete lines added by the padding options. 删除所有空行。不影响填充选项自动插入的空行。 - + Attach a pointer operator to its : 将指针运算符('*')放在: - + Remove all consecutive empty lines. It will NOT delete lines added by the padding options. 将连续的多个空行合并成一个。不影响填充选项自动插入的空行。 - - + + type(left) 类型侧(左侧) - + Fill empty lines with the white space of the previous lines. 使用前一行的缩进空格填充空行 - - + + middle 中间 @@ -3304,127 +3304,147 @@ Are you really want to continue? <html><head/><body><p>预定义排版方案说明</p></body></html> - - + + name(right) 名称侧(右侧) - + Remove unnecessary space adding around parenthesis 删除括号周围的多余空格 - + Attach a reference operator to its : 将引用运算符('&')放在: - - + + none 不变 - + Other 1 其它1 - + Break one line headers ('if','while','else'...) from the statement on the same line 对单行条件('if','while','else')语句分行 - + Add one line braces to unbraced one line conditional statements 用花括号括起单行条件体 - + Break braces before close headers ('else','catch"...) 对结束语句('else','catch')和它之前的花括号断行 - + Remove braces from a braced one line conditional statements 删除括起单行条件体语句的花括号 - + Break 'else if' statements into two lines 将'else if'语句断成两行 - + Add braces to unbraced one line conditional statements 对条件和条件体语句在同一行上的,删除括起条件体语句的花括号 - + Other 2 其它2 - + Attach return type to the function name in its declaration 将函数声明中的函数名和返回值类型放在同一行 - + Break return type from the function name in its declaration 将函数声明中的函数名和返回值类型断成两行 - + Break return type from the function name in its definition 将函数定义中的函数名和返回值类型断成两行 - + Attach return type to the function name in its definition 将函数定义中的函数名和返回值类型放在同一行 - + Don't break blocks residing completely on one line 不对同一行上的多个代码段断行 - + Don't break multimple statements residing on one line 不对同一行上的多条语句断行 - + Other 3 其它3 - + Place the logical conditional to the last on the previous line, when break lines 在断行时,将逻辑条件放在前一行的末尾 - + Close ending angle brackets on template definitions 关闭模板定义末尾的尖括号 - + Remove the leading '*' prefix on multi-line comments and indent the comment text one line indent. 删除多行注释前的'*'并缩进注释内容 - + Break lines exceeds 对超过指定长度的行断行 - + characters 字符 + + + No minimal indent + 无最小缩进量 + + + + Indent at least one additional indent + 至少额外缩进一个缩进量 + + + + Indent at least two additional indents + 至少额外缩进两个缩进量 + + + + Indent at least one-half an additional indent. + 至少额外缩进一个半缩进量 + FormatterPathWidget @@ -3453,187 +3473,187 @@ Are you really want to continue? FormatterStyleModel - + Default 默认 - + The opening braces will not be changed and closing braces will be broken from the preceding line. 左花括号不变,右花括号单独一行。 - + Allman Allman - + Broken braces. 花括号单独一行。 - + Java Java - + Attached braces. 花括号不断行。 - + K&R K&R - + Linux braces. Linux风格花括号 - + Stroustrup Stroustrup - + Linux braces, with broken closing headers. Linux风格花括号,对条件结束语句(如do-while的while)断行。 - + Whitesmith Whitesmith - + Broken, indented braces. 花括号独立成行,并且缩进。 - + Indented class blocks and switch blocks. 类代码段和switch代码段缩进。 - + VTK VTK - + Broken, indented braces except for the opening braces. 除左花括号外,其他花括号独立断行且缩进。 - + Ratliff Ratliff - + Attached, indented braces. 花括号不断行,但是缩进 - + GNU GNU - + Broken braces, indented blocks. 花括号短号,代码段缩进 - + Linux Linux - + Linux braces, minimum conditional indent is one-half indent. Linux风格花括号,最小条件缩进为1.5单位。 - + Horstmann Horstmann - + Run-in braces, indented switches. Run-in花括号,switch语句缩进 - + One True Brace One True Brace - + Linux braces, add braces to all conditionals. Linux花括号,所有条件语句的分支加花括号 - + Google Google - + Attached braces, indented class modifiers. 花括号不断行,类访问限定符缩进 - + Mozilla Mozilla - + Linux braces, with broken braces for structs and enums, and attached braces for namespaces. Linux风格花括号, 结构和枚举的花括号断行, 命名空间的花括号不断行。 - + Webkit Webkit - + Linux braces, with attached closing headers. Linux风格花括号, 条件结束语句(如do-while的while)不断行 - + Pico Pico - + Run-in opening braces and attached closing braces. Run-in左花括号,右花括号不断行 - + Uses keep one line blocks and keep one line statements. 启用保持单行代码段和保持多语句单行选项。 - + Lisp Lisp - + Attached opening braces and attached closing braces. 花括号不断行。 - + Uses keep one line statements. 启用保持多语句单行选项。 diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts index a85bcf4b..106b19d5 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts @@ -2347,6 +2347,22 @@ Place the logical conditional to the last on the previous line, when break lines + + No minimal indent + + + + Indent at least one additional indent + + + + Indent at least two additional indents + + + + Indent at least one-half an additional indent. + + FormatterPathWidget diff --git a/Red_Panda_CPP.pro b/Red_Panda_CPP.pro index ed03f1f7..fd771ad1 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.18 +APP_VERSION = 2.19 # Add the dependencies so that the RedPandaIDE project can add the depended programs # into the main app bundle