[NEW_FEATURE] Smart Indent (in progress).

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1289 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2014-11-13 02:07:46 +00:00
parent 1d92d189b3
commit a0d9227977
1 changed files with 20 additions and 47 deletions

View File

@ -2288,21 +2288,9 @@ bool Notepad_plus::isConditionExprLine(int lineNumber)
else if (type == L_PS) else if (type == L_PS)
mask = 16; mask = 16;
*/ */
const char ifExpr[] = ""; const char ifElseForWhileExpr[] = "((else[ \t]+)?if|for|while)[ \t]*[(].*[)][ \t]*|else[ \t]*";
const char elseExpr[] = "";
const char forLoopExpr[] = "";
const char whileLoopExpr[] = "";
int posFound = _pEditView->execute(SCI_SEARCHINTARGET, strlen(ifExpr), (LPARAM)ifExpr); int posFound = _pEditView->execute(SCI_SEARCHINTARGET, strlen(ifElseForWhileExpr), (LPARAM)ifElseForWhileExpr);
if (posFound != -1 && posFound != -2)
{
//int start = int(_pEditView->execute(SCI_GETTARGETSTART));
int end = int(_pEditView->execute(SCI_GETTARGETEND));
if (end == endPos)
return true;
}
posFound = _pEditView->execute(SCI_SEARCHINTARGET, strlen(elseExpr), (LPARAM)elseExpr);
if (posFound != -1 && posFound != -2) if (posFound != -1 && posFound != -2)
{ {
int end = int(_pEditView->execute(SCI_GETTARGETEND)); int end = int(_pEditView->execute(SCI_GETTARGETEND));
@ -2310,21 +2298,6 @@ bool Notepad_plus::isConditionExprLine(int lineNumber)
return true; return true;
} }
posFound = _pEditView->execute(SCI_SEARCHINTARGET, strlen(forLoopExpr), (LPARAM)forLoopExpr);
if (posFound != -1 && posFound != -2)
{
int end = int(_pEditView->execute(SCI_GETTARGETEND));
if (end == endPos)
return true;
}
posFound = _pEditView->execute(SCI_SEARCHINTARGET, strlen(whileLoopExpr), (LPARAM)whileLoopExpr);
if (posFound != -1 && posFound != -2)
{
int end = int(_pEditView->execute(SCI_GETTARGETEND));
if (end == endPos)
return true;
}
return false; return false;
} }