diff options
Diffstat (limited to 'src/normal.cc')
| -rw-r--r-- | src/normal.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/normal.cc b/src/normal.cc index ba5b6e06..d2318865 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -716,7 +716,7 @@ void paste(Context& context, NormalParams params) { const char reg = params.reg ? params.reg : '"'; auto strings = RegisterManager::instance()[reg].get(context); - const bool linewise = any_of(strings, [](StringView str) { + const bool linewise = all_of(strings, [](StringView str) { return not str.empty() and str.back() == '\n'; }); @@ -741,7 +741,6 @@ void paste_all(Context& context, NormalParams params) { const char reg = params.reg ? params.reg : '"'; auto strings = RegisterManager::instance()[reg].get(context); - bool linewise = false; String all; Vector<ByteCount> offsets; for (auto& str : strings) @@ -749,11 +748,12 @@ void paste_all(Context& context, NormalParams params) if (str.empty()) continue; - if (str.back() == '\n') - linewise = true; all += str; offsets.push_back(all.length()); } + const bool linewise = all_of(strings, [](StringView str) { + return not str.empty() and str.back() == '\n'; + }); if (offsets.empty()) throw runtime_error("nothing to paste"); |
