[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:
parent
1d92d189b3
commit
a0d9227977
@ -2276,55 +2276,28 @@ bool Notepad_plus::isConditionExprLine(int lineNumber)
|
||||
|
||||
int startPos = _pEditView->execute(SCI_POSITIONFROMLINE, lineNumber);
|
||||
int endPos = _pEditView->execute(SCI_GETLINEENDPOSITION, lineNumber);
|
||||
_pEditView->execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP | SCFIND_POSIX);
|
||||
_pEditView->execute(SCI_SETTARGETSTART, startPos);
|
||||
_pEditView->execute(SCI_SETTARGETEND, endPos);
|
||||
|
||||
/*
|
||||
LangType type = _pEditView->getCurrentBuffer()->getLangType();
|
||||
|
||||
if (type == L_HTML || type == L_PHP || type == L_ASP || type == L_JSP)
|
||||
mask = INDIC2_MASK;
|
||||
else if (type == L_PS)
|
||||
mask = 16;
|
||||
*/
|
||||
const char ifExpr[] = "";
|
||||
const char elseExpr[] = "";
|
||||
const char forLoopExpr[] = "";
|
||||
const char whileLoopExpr[] = "";
|
||||
|
||||
int posFound = _pEditView->execute(SCI_SEARCHINTARGET, strlen(ifExpr), (LPARAM)ifExpr);
|
||||
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)
|
||||
{
|
||||
int end = int(_pEditView->execute(SCI_GETTARGETEND));
|
||||
if (end == endPos)
|
||||
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;
|
||||
_pEditView->execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP | SCFIND_POSIX);
|
||||
_pEditView->execute(SCI_SETTARGETSTART, startPos);
|
||||
_pEditView->execute(SCI_SETTARGETEND, endPos);
|
||||
|
||||
/*
|
||||
LangType type = _pEditView->getCurrentBuffer()->getLangType();
|
||||
|
||||
if (type == L_HTML || type == L_PHP || type == L_ASP || type == L_JSP)
|
||||
mask = INDIC2_MASK;
|
||||
else if (type == L_PS)
|
||||
mask = 16;
|
||||
*/
|
||||
const char ifElseForWhileExpr[] = "((else[ \t]+)?if|for|while)[ \t]*[(].*[)][ \t]*|else[ \t]*";
|
||||
|
||||
int posFound = _pEditView->execute(SCI_SEARCHINTARGET, strlen(ifElseForWhileExpr), (LPARAM)ifElseForWhileExpr);
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user