Add support of smart-indenting for Perl and Rust
Close #7980, fix #7958, fix #7961
This commit is contained in:
parent
b5bd5bb026
commit
c6fdb89f88
|
@ -2639,7 +2639,7 @@ void Notepad_plus::maintainIndentation(TCHAR ch)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (type == L_C || type == L_CPP || type == L_JAVA || type == L_CS || type == L_OBJC ||
|
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') ||
|
if (((eolMode == SC_EOL_CRLF || eolMode == SC_EOL_LF) && ch == '\n') ||
|
||||||
(eolMode == SC_EOL_CR && ch == '\r'))
|
(eolMode == SC_EOL_CR && ch == '\r'))
|
||||||
|
@ -2681,6 +2681,11 @@ void Notepad_plus::maintainIndentation(TCHAR ch)
|
||||||
{
|
{
|
||||||
_pEditView->setLineIndent(curLine, indentAmountPrevLine);
|
_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))
|
else if (isConditionExprLine(prevLine))
|
||||||
{
|
{
|
||||||
_pEditView->setLineIndent(curLine, indentAmountPrevLine + tabWidth);
|
_pEditView->setLineIndent(curLine, indentAmountPrevLine + tabWidth);
|
||||||
|
|
Loading…
Reference in New Issue