[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;
|
||||
if (isBlankContained)
|
||||
{
|
||||
env._str2Search = TEXT("\r\n");
|
||||
env._str2Search = TEXT("^[\\t ]*$(\\r\\n|\\r|\\n)");
|
||||
}
|
||||
else
|
||||
{
|
||||
env._str2Search = TEXT("^$");
|
||||
env._str2Search = TEXT("^$(\\r\\n|\\r|\\n)");
|
||||
}
|
||||
env._str4Replace = TEXT("");
|
||||
env._searchType = FindExtended;//FindRegex;
|
||||
//env._doMarkLine = true;
|
||||
env._searchType = FindRegex;
|
||||
|
||||
_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)
|
||||
|
@ -251,6 +251,8 @@ BEGIN
|
||||
MENUITEM "Join Lines", IDM_EDIT_JOIN_LINES
|
||||
MENUITEM "Move Up Current Line", IDM_EDIT_LINE_UP
|
||||
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
|
||||
POPUP "Comment/Uncomment"
|
||||
BEGIN
|
||||
|
@ -836,6 +836,18 @@ void Notepad_plus::command(int id)
|
||||
_pEditView->currentLinesDown();
|
||||
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:
|
||||
_pEditView->convertSelectedTextToUpperCase();
|
||||
break;
|
||||
|
@ -73,6 +73,8 @@
|
||||
#define IDM_EDIT_LINE_DOWN (IDM_EDIT + 15)
|
||||
#define IDM_EDIT_UPPERCASE (IDM_EDIT + 16)
|
||||
#define IDM_EDIT_LOWERCASE (IDM_EDIT + 17)
|
||||
#define IDM_EDIT_REMOVEEMPTYLINES (IDM_EDIT + 55)
|
||||
#define IDM_EDIT_REMOVEEMPTYLINESWITHBLANK (IDM_EDIT + 56)
|
||||
|
||||
// Menu macro
|
||||
#define IDM_MACRO_STARTRECORDINGMACRO (IDM_EDIT + 18)
|
||||
|
Loading…
Reference in New Issue
Block a user