mirror of
https://github.com/textmate/textmate.git
synced 2026-01-14 17:28:05 -05:00
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:
@@ -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";
|
||||
|
||||
@@ -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[] =
|
||||
{
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
namespace ng
|
||||
{
|
||||
find::options_t convert (std::map<std::string, std::string> const& options);
|
||||
|
||||
enum action_t
|
||||
{
|
||||
kMoveBackward,
|
||||
|
||||
Reference in New Issue
Block a user