Add ability to limit removal of consecutive duplicate lines to selected text
Fix #8459, close #8535
This commit is contained in:
parent
8f1b4aa6cc
commit
acb4e5ae18
|
@ -1427,14 +1427,17 @@ void Notepad_plus::removeDuplicateLines()
|
||||||
|
|
||||||
env._str2Search = TEXT("^(.*(\\r?\\n|\\r))(\\1)+");
|
env._str2Search = TEXT("^(.*(\\r?\\n|\\r))(\\1)+");
|
||||||
env._str4Replace = TEXT("\\1");
|
env._str4Replace = TEXT("\\1");
|
||||||
env._searchType = FindRegex;
|
env._searchType = FindRegex;
|
||||||
_findReplaceDlg.processAll(ProcessReplaceAll, &env, true);
|
auto mainSelStart = _pEditView->execute(SCI_GETSELECTIONSTART);
|
||||||
|
auto mainSelEnd = _pEditView->execute(SCI_GETSELECTIONEND);
|
||||||
|
auto mainSelLength = mainSelEnd - mainSelStart;
|
||||||
|
bool isEntireDoc = mainSelLength == 0;
|
||||||
|
env._isInSelection = !isEntireDoc;
|
||||||
|
_findReplaceDlg.processAll(ProcessReplaceAll, &env, isEntireDoc);
|
||||||
|
|
||||||
// remove the last line if it's a duplicate line.
|
// remove the last line if it's a duplicate line.
|
||||||
env._str2Search = TEXT("^(.+)(\\r?\\n|\\r)(\\1)$");
|
env._str2Search = TEXT("^(.+)(\\r?\\n|\\r)(\\1)$");
|
||||||
env._str4Replace = TEXT("\\1");
|
_findReplaceDlg.processAll(ProcessReplaceAll, &env, isEntireDoc);
|
||||||
env._searchType = FindRegex;
|
|
||||||
_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)
|
||||||
|
|
Loading…
Reference in New Issue