Merge remote-tracking branch 'lenormf/fix-2994'
This commit is contained in:
commit
c54e0ec873
|
@ -939,12 +939,20 @@ template<bool smart>
|
||||||
void use_selection_as_search_pattern(Context& context, NormalParams params)
|
void use_selection_as_search_pattern(Context& context, NormalParams params)
|
||||||
{
|
{
|
||||||
const auto& buffer = context.buffer();
|
const auto& buffer = context.buffer();
|
||||||
auto& sel = context.selections().main();
|
String pattern;
|
||||||
const auto beg = sel.min(), end = buffer.char_next(sel.max());
|
|
||||||
String pattern = format("{}{}{}",
|
for (auto& sel : context.selections())
|
||||||
smart and is_bow(buffer, beg) ? "\\b" : "",
|
{
|
||||||
escape(buffer.string(beg, end), "^$\\.*+?()[]{}|", '\\'),
|
const auto beg = sel.min(), end = buffer.char_next(sel.max());
|
||||||
smart and is_eow(buffer, end) ? "\\b" : "");
|
const String sel_pattern = format("{}{}{}",
|
||||||
|
smart and is_bow(buffer, beg) ? "\\b" : "",
|
||||||
|
escape(buffer.string(beg, end), "^$\\.*+?()[]{}|", '\\'),
|
||||||
|
smart and is_eow(buffer, end) ? "\\b" : "");
|
||||||
|
|
||||||
|
if (not pattern.empty())
|
||||||
|
pattern += '|';
|
||||||
|
pattern += sel_pattern;
|
||||||
|
}
|
||||||
|
|
||||||
const char reg = to_lower(params.reg ? params.reg : '/');
|
const char reg = to_lower(params.reg ? params.reg : '/');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user