From c6fdb89f88117a4fd083291a844cb7d10ed55bbf Mon Sep 17 00:00:00 2001 From: Don HO Date: Tue, 10 Mar 2020 03:49:51 +0100 Subject: [PATCH] Add support of smart-indenting for Perl and Rust Close #7980, fix #7958, fix #7961 --- PowerEditor/src/Notepad_plus.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 84c862257..c154031b5 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -2639,7 +2639,7 @@ void Notepad_plus::maintainIndentation(TCHAR ch) return; if (type == L_C || type == L_CPP || type == L_JAVA || type == L_CS || type == L_OBJC || - type == L_PHP || type == L_JS || type == L_JAVASCRIPT || type == L_JSP || type == L_CSS) + type == L_PHP || type == L_JS || type == L_JAVASCRIPT || type == L_JSP || type == L_CSS || type == L_PERL || type == L_RUST) { if (((eolMode == SC_EOL_CRLF || eolMode == SC_EOL_LF) && ch == '\n') || (eolMode == SC_EOL_CR && ch == '\r')) @@ -2681,6 +2681,11 @@ void Notepad_plus::maintainIndentation(TCHAR ch) { _pEditView->setLineIndent(curLine, indentAmountPrevLine); } + // These languages do no support single line control structures without braces. + else if (type == L_PERL || type == L_RUST) + { + _pEditView->setLineIndent(curLine, indentAmountPrevLine); + } else if (isConditionExprLine(prevLine)) { _pEditView->setLineIndent(curLine, indentAmountPrevLine + tabWidth);