Use find clipboard when no string is present in macro

This makes it possible to combine the “Use Selection for Find / Replace” with a non-simple find action (e.g. “Replace All”).

If any find options are set (case sensitive, regular expression, etc.) then these will trump the options set for the entry on the find clipboard.
This commit is contained in:
Allan Odgaard
2015-06-12 14:16:50 +02:00
parent f4089e76fd
commit ec37b09faf
3 changed files with 13 additions and 1 deletions

View File

@@ -211,9 +211,19 @@ namespace ng
plist::get_key_path(args, "replaceString", replaceWith);
if(searchFor != NULL_STR)
{
find_clipboard()->push_back(searchFor);
}
else if(clipboard_t::entry_ptr searchEntry = find_clipboard()->current())
{
searchFor = searchEntry->content();
options |= convert(searchEntry->options());
}
if(replaceWith != NULL_STR)
replace_clipboard()->push_back(replaceWith);
else if(clipboard_t::entry_ptr replaceEntry = replace_clipboard()->current())
replaceWith = replaceEntry->content();
std::string where;
bool searchOnlySelection = plist::get_key_path(args, "replaceAllScope", where) && where == "selection";

View File

@@ -59,7 +59,7 @@ namespace ng
return str;
}
static find::options_t convert (std::map<std::string, std::string> const& options)
find::options_t convert (std::map<std::string, std::string> const& options)
{
static struct { std::string key; find::options_t flag; } const optionMap[] =
{

View File

@@ -11,6 +11,8 @@
namespace ng
{
find::options_t convert (std::map<std::string, std::string> const& options);
enum action_t
{
kMoveBackward,