Skip to content

Commit 86f6330

Browse files
committed
Maintain indentation
1 parent a36ae03 commit 86f6330

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

LuaConsole.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@ bool LuaConsole::processNotification(const SCNotification *scn) {
119119
if ((scn->ch == '.' || scn->ch == ':') && m_sciInput->Call(SCI_GETCURRENTPOS) > 1) {
120120
showAutoCompletion();
121121
}
122+
else if (scn->ch == '\n') {
123+
int curPos = m_sciInput->Call(SCI_GETCURRENTPOS);
124+
int curLine = m_sciInput->Call(SCI_LINEFROMPOSITION, curPos);
125+
int prevIndent = m_sciInput->Call(SCI_GETLINEINDENTATION, curLine - 1);
126+
m_sciInput->Call(SCI_SETLINEINDENTATION, curLine, prevIndent);
127+
curPos = m_sciInput->Call(SCI_GETLINEINDENTPOSITION, curLine);
128+
m_sciInput->Call(SCI_SETEMPTYSELECTION, curPos);
129+
}
122130
break;
123131
}
124132
}

0 commit comments

Comments
 (0)