diff options
| author | Maxime Coste <mawww@kakoune.org> | 2018-05-31 20:59:21 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2018-07-05 07:54:28 +1000 |
| commit | 8b2e5ea862c748e13fbfd49ee3a00c8918d3ee10 (patch) | |
| tree | f29adb218b2e37187efb36089d08f38d039ed959 /src/selection.cc | |
| parent | 2729042f83493d76cc9b135c45f326eaf878bec4 (diff) | |
Make selection lists use the option list syntax
Diffstat (limited to 'src/selection.cc')
| -rw-r--r-- | src/selection.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/selection.cc b/src/selection.cc index 2a4a4629..1cd8641c 100644 --- a/src/selection.cc +++ b/src/selection.cc @@ -477,7 +477,7 @@ String selection_list_to_string(const SelectionList& selections) auto main = beg + selections.main_index(); using View = ConstArrayView<Selection>; return join(concatenated(View{main, end}, View{beg, main}) | - transform(selection_to_string), ':', false); + transform(selection_to_string), ' ', false); } Selection selection_from_string(StringView desc) @@ -502,14 +502,13 @@ Selection selection_from_string(StringView desc) return Selection{anchor, cursor}; } -SelectionList selection_list_from_string(Buffer& buffer, StringView desc) +SelectionList selection_list_from_string(Buffer& buffer, ConstArrayView<String> descs) { - if (desc.empty()) + if (descs.empty()) throw runtime_error{"empty selection description"}; - auto sels = desc | split<StringView>(':') - | transform([&](auto&& d) { auto s = selection_from_string(d); clamp(s, buffer); return s; }) - | gather<Vector<Selection>>(); + auto sels = descs | transform([&](auto&& d) { auto s = selection_from_string(d); clamp(s, buffer); return s; }) + | gather<Vector<Selection>>(); return {SelectionList::UnsortedTag{}, buffer, std::move(sels)}; } |
