Add support of smart-indenting for Perl and Rust

Close #7980, fix #7958, fix #7961
This commit is contained in:
Don HO 2020-03-10 03:49:51 +01:00
parent b5bd5bb026
commit c6fdb89f88
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
1 changed files with 6 additions and 1 deletions

View File

@ -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);