summaryrefslogtreecommitdiff
path: root/src/ranges.hh
diff options
context:
space:
mode:
authorFrank LENORMAND <lenormf@gmail.com>2021-10-20 21:44:31 +0200
committerFrank LENORMAND <lenormf@gmail.com>2021-10-24 09:01:24 +0200
commit16dfe977b23e92d6317869bb4bcf4e3839516bd3 (patch)
tree93efeec1d3c743b868368ba9a109afac318db5ec /src/ranges.hh
parent0af234a3293c632479ed708388fd73547851a9fd (diff)
src: Make `gf` open all selected paths
The buffer whose path is under the main selection will be focused after all others have been opened. Closes #2164
Diffstat (limited to 'src/ranges.hh')
-rw-r--r--src/ranges.hh13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/ranges.hh b/src/ranges.hh
index 3480cab9..8666510c 100644
--- a/src/ranges.hh
+++ b/src/ranges.hh
@@ -164,16 +164,16 @@ struct EnumerateView
struct Iterator : std::iterator<std::forward_iterator_tag,
typename std::iterator_traits<RangeIt>::value_type>
{
- Iterator(size_t index, RangeIt it, RangeIt end)
- : m_index{index}, m_it{std::move(it)}, m_end{std::move(end)} {}
+ Iterator(size_t index, RangeIt it)
+ : m_index{index}, m_it{std::move(it)} {}
- decltype(auto) operator*() { return std::make_tuple(m_index, *m_it); }
+ decltype(auto) operator*() { return std::tuple<size_t, decltype(*m_it)>(m_index, *m_it); }
Iterator& operator++() { ++m_index; ++m_it; return *this; }
Iterator operator++(int) { auto copy = *this; ++(*this); return copy; }
friend bool operator==(const Iterator& lhs, const Iterator& rhs)
{
- return lhs.m_index == rhs.m_index and lhs.m_it == rhs.m_it;
+ return lhs.m_it == rhs.m_it;
}
friend bool operator!=(const Iterator& lhs, const Iterator& rhs)
@@ -186,11 +186,10 @@ struct EnumerateView
private:
size_t m_index;
RangeIt m_it;
- RangeIt m_end;
};
- Iterator begin() const { return {0, std::begin(m_range), std::end(m_range)}; }
- Iterator end() const { return {std::size(m_range), std::end(m_range), std::end(m_range)}; }
+ Iterator begin() const { return {0, std::begin(m_range)}; }
+ Iterator end() const { return {(size_t)-1, std::end(m_range)}; }
Range m_range;
};