From bf34ef0dd568b792627813a4445adf649a5c5ba6 Mon Sep 17 00:00:00 2001 From: ArkadiuszMichalski <2730894+ArkadiuszMichalski@users.noreply.github.com> Date: Sun, 11 Dec 2022 03:46:52 +0100 Subject: [PATCH] Fix Trim Operations not working on selection Trim Operations works for entire document only. Now selection for Trim Operations is supported. Fix #12602, close #12626 --- PowerEditor/src/Notepad_plus.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index e1153c595..259e1e13c 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -1486,8 +1486,10 @@ void Notepad_plus::doTrim(trimOp whichPart) else return; env._str4Replace = TEXT(""); - env._searchType = FindRegex; - _findReplaceDlg.processAll(ProcessReplaceAll, &env, true); + env._searchType = FindRegex; + bool isEntireDoc = _pEditView->execute(SCI_GETSELECTIONSTART) == _pEditView->execute(SCI_GETSELECTIONEND); + env._isInSelection = !isEntireDoc; + _findReplaceDlg.processAll(ProcessReplaceAll, &env, isEntireDoc); } void Notepad_plus::removeEmptyLine(bool isBlankContained)