Fix auto-indent issue by typing Enter on empty line.

Do not alter indentation if we were at the beginning of the line and we pressed Enter.

Fix #443, close #4991
This commit is contained in:
Cyril Ganchev 2018-11-06 17:25:06 +02:00 committed by Don HO
parent fd51703ad8
commit 08b0156472
1 changed files with 5 additions and 0 deletions

View File

@ -2550,6 +2550,11 @@ void Notepad_plus::maintainIndentation(TCHAR ch)
LangType type = _pEditView->getCurrentBuffer()->getLangType();
// Do not alter indentation if we were at the beginning of the line and we pressed Enter
if ((((eolMode == SC_EOL_CRLF || eolMode == SC_EOL_LF) && ch == '\n') ||
(eolMode == SC_EOL_CR && ch == '\r')) && prevLine >= 0 && _pEditView->getLineLength(prevLine) == 0)
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)
{