From e91289fda1c81bc3f3cc32735a1b6841e6df55a5 Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Thu, 9 Mar 2023 22:09:12 +0100 Subject: [PATCH] Add IntoIterator implementation for Selection --- helix-core/src/selection.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/helix-core/src/selection.rs b/helix-core/src/selection.rs index 0eb2b755e..8e93c633e 100644 --- a/helix-core/src/selection.rs +++ b/helix-core/src/selection.rs @@ -661,6 +661,15 @@ impl<'a> IntoIterator for &'a Selection { } } +impl IntoIterator for Selection { + type Item = Range; + type IntoIter = smallvec::IntoIter<[Range; 1]>; + + fn into_iter(self) -> smallvec::IntoIter<[Range; 1]> { + self.ranges.into_iter() + } +} + // TODO: checkSelection -> check if valid for doc length && sorted pub fn keep_or_remove_matches(