Improve text selection after Replace All In Selection operation
Fix #9270, close #9273
This commit is contained in:
parent
0546f75a71
commit
8f38707d33
@ -2023,7 +2023,23 @@ int FindReplaceDlg::processAll(ProcessOperation op, const FindOption *opt, bool
|
|||||||
findReplaceInfo._txt2replace = txt2replace;
|
findReplaceInfo._txt2replace = txt2replace;
|
||||||
findReplaceInfo._startRange = startPosition;
|
findReplaceInfo._startRange = startPosition;
|
||||||
findReplaceInfo._endRange = endPosition;
|
findReplaceInfo._endRange = endPosition;
|
||||||
return processRange(op, findReplaceInfo, pFindersInfo, pOptions, colourStyleID);
|
|
||||||
|
int nbProcessed = processRange(op, findReplaceInfo, pFindersInfo, pOptions, colourStyleID);
|
||||||
|
|
||||||
|
if (nbProcessed > 0 && op == ProcessReplaceAll && pOptions->_isInSelection)
|
||||||
|
{
|
||||||
|
int newDocLength = static_cast<int>((*_ppEditView)->execute(SCI_GETLENGTH));
|
||||||
|
endPosition += newDocLength - docLength;
|
||||||
|
(*_ppEditView)->execute(SCI_SETSELECTION, endPosition, startPosition);
|
||||||
|
(*_ppEditView)->execute(SCI_SCROLLRANGE, startPosition, endPosition);
|
||||||
|
if (startPosition == endPosition)
|
||||||
|
{
|
||||||
|
setChecked(IDC_IN_SELECTION_CHECK, false);
|
||||||
|
enableFindDlgItem(IDC_IN_SELECTION_CHECK, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nbProcessed;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findReplaceInfo, const FindersInfo * pFindersInfo, const FindOption *opt, int colourStyleID, ScintillaEditView *view2Process)
|
int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findReplaceInfo, const FindersInfo * pFindersInfo, const FindOption *opt, int colourStyleID, ScintillaEditView *view2Process)
|
||||||
@ -2651,7 +2667,6 @@ void FindReplaceDlg::enableReplaceFunc(bool isEnable)
|
|||||||
showFindDlgItem(IDREPLACE, isEnable);
|
showFindDlgItem(IDREPLACE, isEnable);
|
||||||
showFindDlgItem(IDREPLACEWITH, isEnable);
|
showFindDlgItem(IDREPLACEWITH, isEnable);
|
||||||
showFindDlgItem(IDREPLACEALL, isEnable);
|
showFindDlgItem(IDREPLACEALL, isEnable);
|
||||||
showFindDlgItem(IDREPLACEINSEL, isEnable);
|
|
||||||
showFindDlgItem(IDC_REPLACE_OPENEDFILES, isEnable);
|
showFindDlgItem(IDC_REPLACE_OPENEDFILES, isEnable);
|
||||||
showFindDlgItem(IDC_REPLACEINSELECTION);
|
showFindDlgItem(IDC_REPLACEINSELECTION);
|
||||||
showFindDlgItem(IDC_IN_SELECTION_CHECK);
|
showFindDlgItem(IDC_IN_SELECTION_CHECK);
|
||||||
@ -3260,7 +3275,6 @@ void FindReplaceDlg::enableMarkFunc()
|
|||||||
showFindDlgItem(IDREPLACE, false);
|
showFindDlgItem(IDREPLACE, false);
|
||||||
showFindDlgItem(IDREPLACEWITH, false);
|
showFindDlgItem(IDREPLACEWITH, false);
|
||||||
showFindDlgItem(IDREPLACEALL, false);
|
showFindDlgItem(IDREPLACEALL, false);
|
||||||
showFindDlgItem(IDREPLACEINSEL, false);
|
|
||||||
showFindDlgItem(IDC_REPLACE_OPENEDFILES, false);
|
showFindDlgItem(IDC_REPLACE_OPENEDFILES, false);
|
||||||
showFindDlgItem(IDC_REPLACEINSELECTION, false);
|
showFindDlgItem(IDC_REPLACEINSELECTION, false);
|
||||||
|
|
||||||
|
@ -44,7 +44,6 @@
|
|||||||
#define IDUNSLASH 1607
|
#define IDUNSLASH 1607
|
||||||
#define IDREPLACE 1608
|
#define IDREPLACE 1608
|
||||||
#define IDREPLACEALL 1609
|
#define IDREPLACEALL 1609
|
||||||
#define IDREPLACEINSEL 1610
|
|
||||||
#define ID_STATICTEXT_REPLACE 1611
|
#define ID_STATICTEXT_REPLACE 1611
|
||||||
//#define IDDIRECTIONUP 1612
|
//#define IDDIRECTIONUP 1612
|
||||||
//#define IDDIRECTIONDOWN 1613
|
//#define IDDIRECTIONDOWN 1613
|
||||||
|
Loading…
Reference in New Issue
Block a user