summaryrefslogtreecommitdiff
path: root/src/normal.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2018-01-30 11:08:03 +1100
committerMaxime Coste <mawww@kakoune.org>2018-01-31 09:31:18 +1100
commit81eb2ee428fbc11f311073ffa70342e31eacf6c3 (patch)
tree3cb4e280d8c61024eb7a900e5d220729b31d2fcf /src/normal.cc
parentc30a954dfc5264ae8583824abd46753e9b6bd204 (diff)
Do not strip whitespaces with '*'
Stripping whitespaces there is a failed experiment as it breaks the ability to use multi-selections consistently: Using '*' followed by some `N` to add following matches, we end up with mismatched selections due to whitespace stripping the original selection still contains whitespaces where all the new ones do not. Once we get to this state, most selection commands will give different results for the initial selection and the other ones, breaking predictible multiselection use, one of the cornerstones of Kakoune editing model.
Diffstat (limited to 'src/normal.cc')
-rw-r--r--src/normal.cc10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/normal.cc b/src/normal.cc
index d890ab7d..86c49e00 100644
--- a/src/normal.cc
+++ b/src/normal.cc
@@ -838,15 +838,7 @@ void use_selection_as_search_pattern(Context& context, NormalParams params)
const auto& buffer = context.buffer();
for (auto& sel : sels)
{
- auto beg = sel.min(), end = sel.max();
- if (smart) // skip whitespaces
- {
- while (is_blank(buffer.byte_at(beg)) and beg != end)
- beg = buffer.char_next(beg);
- while (is_blank(buffer.byte_at(end)) and beg != end)
- end = buffer.char_prev(end);
- }
- end = buffer.char_next(end);
+ const auto beg = sel.min(), end = buffer.char_next(sel.max());
patterns.push_back(format("{}\\Q{}\\E{}",
smart and is_bow(buffer, beg) ? "\\b" : "",
buffer.string(beg, end),