[NEW_FEATURE] Add Remove empty lines feature.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@991 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
bcb502808e
commit
8f1e8ccda6
@ -1236,17 +1236,28 @@ void Notepad_plus::removeEmptyLine(bool isBlankContained)
|
|||||||
FindOption env;
|
FindOption env;
|
||||||
if (isBlankContained)
|
if (isBlankContained)
|
||||||
{
|
{
|
||||||
env._str2Search = TEXT("\r\n");
|
env._str2Search = TEXT("^[\\t ]*$(\\r\\n|\\r|\\n)");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
env._str2Search = TEXT("^$");
|
env._str2Search = TEXT("^$(\\r\\n|\\r|\\n)");
|
||||||
}
|
}
|
||||||
env._str4Replace = TEXT("");
|
env._str4Replace = TEXT("");
|
||||||
env._searchType = FindExtended;//FindRegex;
|
env._searchType = FindRegex;
|
||||||
//env._doMarkLine = true;
|
|
||||||
|
|
||||||
_findReplaceDlg.processAll(ProcessReplaceAll, &env, true);
|
_findReplaceDlg.processAll(ProcessReplaceAll, &env, true);
|
||||||
|
|
||||||
|
|
||||||
|
// remove the last line if it's an empty line.
|
||||||
|
if (isBlankContained)
|
||||||
|
{
|
||||||
|
env._str2Search = TEXT("(\\r\\n|\\r|\\n)^[\\t ]*$");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
env._str2Search = TEXT("(\\r\\n|\\r|\\n)^$");
|
||||||
|
}
|
||||||
|
_findReplaceDlg.processAll(ProcessReplaceAll, &env, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notepad_plus::getMatchedFileNames(const TCHAR *dir, const vector<generic_string> & patterns, vector<generic_string> & fileNames, bool isRecursive, bool isInHiddenDir)
|
void Notepad_plus::getMatchedFileNames(const TCHAR *dir, const vector<generic_string> & patterns, vector<generic_string> & fileNames, bool isRecursive, bool isInHiddenDir)
|
||||||
|
@ -251,6 +251,8 @@ BEGIN
|
|||||||
MENUITEM "Join Lines", IDM_EDIT_JOIN_LINES
|
MENUITEM "Join Lines", IDM_EDIT_JOIN_LINES
|
||||||
MENUITEM "Move Up Current Line", IDM_EDIT_LINE_UP
|
MENUITEM "Move Up Current Line", IDM_EDIT_LINE_UP
|
||||||
MENUITEM "Move Down Current Line", IDM_EDIT_LINE_DOWN
|
MENUITEM "Move Down Current Line", IDM_EDIT_LINE_DOWN
|
||||||
|
MENUITEM "Remove Empty Lines", IDM_EDIT_REMOVEEMPTYLINES
|
||||||
|
MENUITEM "Remove Empty Lines (Containing Blank characters)", IDM_EDIT_REMOVEEMPTYLINESWITHBLANK
|
||||||
END
|
END
|
||||||
POPUP "Comment/Uncomment"
|
POPUP "Comment/Uncomment"
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -836,6 +836,18 @@ void Notepad_plus::command(int id)
|
|||||||
_pEditView->currentLinesDown();
|
_pEditView->currentLinesDown();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IDM_EDIT_REMOVEEMPTYLINES:
|
||||||
|
_pEditView->execute(SCI_BEGINUNDOACTION);
|
||||||
|
removeEmptyLine(false);
|
||||||
|
_pEditView->execute(SCI_ENDUNDOACTION);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IDM_EDIT_REMOVEEMPTYLINESWITHBLANK:
|
||||||
|
_pEditView->execute(SCI_BEGINUNDOACTION);
|
||||||
|
removeEmptyLine(true);
|
||||||
|
_pEditView->execute(SCI_ENDUNDOACTION);
|
||||||
|
break;
|
||||||
|
|
||||||
case IDM_EDIT_UPPERCASE:
|
case IDM_EDIT_UPPERCASE:
|
||||||
_pEditView->convertSelectedTextToUpperCase();
|
_pEditView->convertSelectedTextToUpperCase();
|
||||||
break;
|
break;
|
||||||
|
@ -73,6 +73,8 @@
|
|||||||
#define IDM_EDIT_LINE_DOWN (IDM_EDIT + 15)
|
#define IDM_EDIT_LINE_DOWN (IDM_EDIT + 15)
|
||||||
#define IDM_EDIT_UPPERCASE (IDM_EDIT + 16)
|
#define IDM_EDIT_UPPERCASE (IDM_EDIT + 16)
|
||||||
#define IDM_EDIT_LOWERCASE (IDM_EDIT + 17)
|
#define IDM_EDIT_LOWERCASE (IDM_EDIT + 17)
|
||||||
|
#define IDM_EDIT_REMOVEEMPTYLINES (IDM_EDIT + 55)
|
||||||
|
#define IDM_EDIT_REMOVEEMPTYLINESWITHBLANK (IDM_EDIT + 56)
|
||||||
|
|
||||||
// Menu macro
|
// Menu macro
|
||||||
#define IDM_MACRO_STARTRECORDINGMACRO (IDM_EDIT + 18)
|
#define IDM_MACRO_STARTRECORDINGMACRO (IDM_EDIT + 18)
|
||||||
|
Loading…
Reference in New Issue
Block a user