Skip to content

Commit

Permalink
FarGroupgh-600: Shift+F7 and Alt+F7 search in absolute direction.
Browse files Browse the repository at this point in the history
Also, on the Search / Replace dialog, replaced "Reverse" checkbox with "Search Down / Up" buttons.
  • Loading branch information
MKadaner committed Feb 20, 2023
1 parent 18132c7 commit ac26354
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 21 deletions.
11 changes: 7 additions & 4 deletions far/stddlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

//----------------------------------------------------------------------------

int GetSearchReplaceString(
SearchReplaceDlgResult GetSearchReplaceString(
SearchReplaceDlgParams& Params,
string_view TextHistoryName,
string_view ReplaceHistoryName,
Expand Down Expand Up @@ -145,8 +145,11 @@ int GetSearchReplaceString(
dlg_checkbox_fuzzy,
dlg_checkbox_style,
dlg_separator_2,
dlg_button_action,
dlg_button_all,
dlg_button_search,
dlg_button_search_down,
dlg_button_search_up,
dlg_button_replace,
dlg_button_find_all,
dlg_button_cancel,

dlg_count
Expand Down Expand Up @@ -250,7 +253,7 @@ int GetSearchReplaceString(
SetSelected(dlg_checkbox_style, Params.PreserveStyle.value_or(false));

// dlg_button_all
SetFlagIf(dlg_button_all, DIF_HIDDEN, Params.ReplaceMode || !Params.ShowButtonAll);
SetFlagIf(dlg_button_all, DIF_HIDDEN, Params.ReplaceMode || !Params.ShowButtonFindAll);

bool TextOrHexHotkeyUsed{};

Expand Down
38 changes: 21 additions & 17 deletions far/stddlg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,47 +58,51 @@ struct error_state_ex;
struct SearchReplaceDlgParams
{
bool ReplaceMode{};
bool ShowButtonAll{};
bool ShowButtonFindAll{};
bool ShowButtonsUpDown{};
string SearchStr;
bytes SearchBytes;
string ReplaceStr;
std::optional<bool> Hex;
std::optional<bool> CaseSensitive;
std::optional<bool> WholeWords;
std::optional<bool> Reverse;
std::optional<bool> Regexp;
std::optional<bool> Fuzzy;
std::optional<bool> PreserveStyle;
};

enum class SearchReplaceDlgResult
{
Dismissed,
Search,
SearchDown,
SearchUp,
Replace,
FindAll,
};

/*
Функция GetSearchReplaceString выводит диалог поиска или замены, принимает
от пользователя данные и в случае успешного выполнения диалога возвращает
TRUE.
Параметры:
Shows Search / Replace dialog, coolects user's input, and returns the action selected by the user.
Parameters:
Params
InOut parameter. Specifies which options to show in the dialog and provides initial values.
On exit, contains the values selected by the user.
InOut parameter. Specifies which options to show in the dialog and provides initial values.
If the dialog was closed by one of the action buttons, contains the values selected by the user.
If the dialog was dismissed, the values stay unchanged.
TextHistoryName
TextHistoryName
Имя истории строки поиска.
Если пустая строка, то принимается значение "SearchText"
ReplaceHistoryName
Имя истории строки замены.
Если пустая строка, то принимается значение "ReplaceText"
HelpTopic
Имя темы помощи.
Если пустая строка - тема помощи не назначается.
Возвращаемое значение:
0 - пользователь отказался от диалога (Esc)
1 - пользователь подтвердил свои намерения
2 - выбран поиск всех вхождений
Returns the action selected by the user.
*/
int GetSearchReplaceString(
SearchReplaceDlgResult GetSearchReplaceString(
SearchReplaceDlgParams& Params,
string_view TextHistoryName,
string_view ReplaceHistoryName,
Expand Down

0 comments on commit ac26354

Please sign in to comment.