mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-22 21:34:58 +02:00
[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 startPos = _pEditView->execute(SCI_POSITIONFROMLINE, lineNumber);
|
||||||
int endPos = _pEditView->execute(SCI_GETLINEENDPOSITION, lineNumber);
|
int endPos = _pEditView->execute(SCI_GETLINEENDPOSITION, lineNumber);
|
||||||
_pEditView->execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP | SCFIND_POSIX);
|
_pEditView->execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP | SCFIND_POSIX);
|
||||||
_pEditView->execute(SCI_SETTARGETSTART, startPos);
|
_pEditView->execute(SCI_SETTARGETSTART, startPos);
|
||||||
_pEditView->execute(SCI_SETTARGETEND, endPos);
|
_pEditView->execute(SCI_SETTARGETEND, endPos);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
LangType type = _pEditView->getCurrentBuffer()->getLangType();
|
LangType type = _pEditView->getCurrentBuffer()->getLangType();
|
||||||
|
|
||||||
if (type == L_HTML || type == L_PHP || type == L_ASP || type == L_JSP)
|
if (type == L_HTML || type == L_PHP || type == L_ASP || type == L_JSP)
|
||||||
mask = INDIC2_MASK;
|
mask = INDIC2_MASK;
|
||||||
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[] = "";
|
int posFound = _pEditView->execute(SCI_SEARCHINTARGET, strlen(ifElseForWhileExpr), (LPARAM)ifElseForWhileExpr);
|
||||||
const char whileLoopExpr[] = "";
|
if (posFound != -1 && posFound != -2)
|
||||||
|
{
|
||||||
int posFound = _pEditView->execute(SCI_SEARCHINTARGET, strlen(ifExpr), (LPARAM)ifExpr);
|
int end = int(_pEditView->execute(SCI_GETTARGETEND));
|
||||||
if (posFound != -1 && posFound != -2)
|
if (end == endPos)
|
||||||
{
|
return true;
|
||||||
//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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user