Allow scope of Remove Empty Lines to be limited by an active selection
Close #8428, close #8429
This commit is contained in:
parent
d13795a37a
commit
4e4e40c338
|
@ -1400,10 +1400,13 @@ void Notepad_plus::removeEmptyLine(bool isBlankContained)
|
||||||
env._str2Search = TEXT("^$(\\r\\n|\\r|\\n)");
|
env._str2Search = TEXT("^$(\\r\\n|\\r|\\n)");
|
||||||
}
|
}
|
||||||
env._str4Replace = TEXT("");
|
env._str4Replace = TEXT("");
|
||||||
env._searchType = FindRegex;
|
env._searchType = FindRegex;
|
||||||
|
auto mainSelStart = _pEditView->execute(SCI_GETSELECTIONSTART);
|
||||||
_findReplaceDlg.processAll(ProcessReplaceAll, &env, true);
|
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 an empty line.
|
// remove the last line if it's an empty line.
|
||||||
if (isBlankContained)
|
if (isBlankContained)
|
||||||
|
@ -1414,7 +1417,7 @@ void Notepad_plus::removeEmptyLine(bool isBlankContained)
|
||||||
{
|
{
|
||||||
env._str2Search = TEXT("(\\r\\n|\\r|\\n)^$");
|
env._str2Search = TEXT("(\\r\\n|\\r|\\n)^$");
|
||||||
}
|
}
|
||||||
_findReplaceDlg.processAll(ProcessReplaceAll, &env, true);
|
_findReplaceDlg.processAll(ProcessReplaceAll, &env, isEntireDoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notepad_plus::removeDuplicateLines()
|
void Notepad_plus::removeDuplicateLines()
|
||||||
|
|
Loading…
Reference in New Issue