Remember "Bookmark Line" and "Purge" options in Mark dlg through the session

Fix #13277, close #13443
This commit is contained in:
Alan Kilborn 2023-03-29 13:10:53 -04:00 committed by Don Ho
parent a67a5f7170
commit b54b9c49ce
3 changed files with 19 additions and 2 deletions

View File

@ -2701,6 +2701,14 @@ void NppParameters::feedFindHistoryParameters(TiXmlNode *node)
boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("regexBackward4PowerUser"));
if (boolStr)
_findHistory._regexBackward4PowerUser = (lstrcmp(TEXT("yes"), boolStr) == 0);
boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("bookmarkLine"));
if (boolStr)
_findHistory._isBookmarkLine = (lstrcmp(TEXT("yes"), boolStr) == 0);
boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("purge"));
if (boolStr)
_findHistory._isPurge = (lstrcmp(TEXT("yes"), boolStr) == 0);
}
void NppParameters::feedShortcut(TiXmlNode *node)
@ -7352,6 +7360,9 @@ bool NppParameters::writeFindHistory()
(findHistoryRoot->ToElement())->SetAttribute(TEXT("isSearch2ButtonsMode"), _findHistory._isSearch2ButtonsMode?TEXT("yes"):TEXT("no"));
(findHistoryRoot->ToElement())->SetAttribute(TEXT("regexBackward4PowerUser"), _findHistory._regexBackward4PowerUser ? TEXT("yes") : TEXT("no"));
(findHistoryRoot->ToElement())->SetAttribute(TEXT("bookmarkLine"), _findHistory._isBookmarkLine ? TEXT("yes") : TEXT("no"));
(findHistoryRoot->ToElement())->SetAttribute(TEXT("purge"), _findHistory._isPurge ? TEXT("yes") : TEXT("no"));
TiXmlElement hist_element{TEXT("")};
hist_element.SetValue(TEXT("Path"));

View File

@ -1205,6 +1205,9 @@ struct FindHistory final
bool _isFilterFollowDoc = false;
bool _isFolderFollowDoc = false;
bool _isBookmarkLine = false;
bool _isPurge = false;
// Allow regExpr backward search: this option is not present in UI, only to modify in config.xml
bool _regexBackward4PowerUser = false;
};

View File

@ -386,6 +386,9 @@ void FindReplaceDlg::fillFindHistory()
::SendDlgItemMessage(_hSelf, IDREGEXP, BM_SETCHECK, findHistory._searchMode == FindHistory::regExpr, 0);
::SendDlgItemMessage(_hSelf, IDREDOTMATCHNL, BM_SETCHECK, findHistory._dotMatchesNewline, 0);
::SendDlgItemMessage(_hSelf, IDC_MARKLINE_CHECK, BM_SETCHECK, findHistory._isBookmarkLine, 0);
::SendDlgItemMessage(_hSelf, IDC_PURGE_CHECK, BM_SETCHECK, findHistory._isPurge, 0);
::SendDlgItemMessage(_hSelf, IDC_2_BUTTONS_MODE, BM_SETCHECK, findHistory._isSearch2ButtonsMode, 0);
if (findHistory._searchMode == FindHistory::regExpr)
@ -2171,14 +2174,14 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
case IDC_PURGE_CHECK :
{
if (_currentStatus == MARK_DLG)
_options._doPurge = isCheckedOrNot(IDC_PURGE_CHECK);
findHistory._isPurge = _options._doPurge = isCheckedOrNot(IDC_PURGE_CHECK);
}
return TRUE;
case IDC_MARKLINE_CHECK :
{
if (_currentStatus == MARK_DLG)
_options._doMarkLine = isCheckedOrNot(IDC_MARKLINE_CHECK);
findHistory._isBookmarkLine = _options._doMarkLine = isCheckedOrNot(IDC_MARKLINE_CHECK);
}
return TRUE;