diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2016-07-14 21:14:17 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2016-07-14 21:14:17 +0100 |
| commit | b988871df6636c1b7d5938d1ac2d2700a6a59158 (patch) | |
| tree | 2ad9e8263154a7606a44c668ebb57192c146b0d6 /src/selection.cc | |
| parent | 52d3b60aaab913f80c361eb130dce6ea98f6e238 (diff) | |
Ensure selections are sorted and non overlapping in selections_list_from_string
Diffstat (limited to 'src/selection.cc')
| -rw-r--r-- | src/selection.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/selection.cc b/src/selection.cc index 36c1cdf2..47597a50 100644 --- a/src/selection.cc +++ b/src/selection.cc @@ -613,6 +613,10 @@ SelectionList selection_list_from_string(Buffer& buffer, StringView desc) clamp(sel, buffer); sels.push_back(sel); } + size_t main = 0; + std::sort(sels.begin(), sels.end(), compare_selections); + sels.erase(merge_overlapping(sels.begin(), sels.end(), main, overlaps), sels.end()); + return {buffer, std::move(sels)}; } |
