mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-23 15:23:29 +03:00
Move skip_while helpers to selectors.hh
This commit is contained in:
parent
56b5300b9d
commit
adaf6ecc40
@ -18,6 +18,20 @@ inline Selection keep_direction(Selection res, const Selection& ref)
|
||||
return res;
|
||||
}
|
||||
|
||||
template<typename Iterator, typename EndIterator, typename T>
|
||||
void skip_while(Iterator& it, const EndIterator& end, T condition)
|
||||
{
|
||||
while (it != end and condition(*it))
|
||||
++it;
|
||||
}
|
||||
|
||||
template<typename Iterator, typename BeginIterator, typename T>
|
||||
void skip_while_reverse(Iterator& it, const BeginIterator& begin, T condition)
|
||||
{
|
||||
while (it != begin and condition(*it))
|
||||
--it;
|
||||
}
|
||||
|
||||
using Utf8Iterator = utf8::iterator<BufferIterator, utf8::InvalidPolicy::Pass>;
|
||||
|
||||
inline Selection utf8_range(const Utf8Iterator& first, const Utf8Iterator& last)
|
||||
|
14
src/utils.hh
14
src/utils.hh
@ -78,20 +78,6 @@ private:
|
||||
template<typename T>
|
||||
T* Singleton<T>::ms_instance = nullptr;
|
||||
|
||||
template<typename Iterator, typename EndIterator, typename T>
|
||||
void skip_while(Iterator& it, const EndIterator& end, T condition)
|
||||
{
|
||||
while (it != end and condition(*it))
|
||||
++it;
|
||||
}
|
||||
|
||||
template<typename Iterator, typename BeginIterator, typename T>
|
||||
void skip_while_reverse(Iterator& it, const BeginIterator& begin, T condition)
|
||||
{
|
||||
while (it != begin and condition(*it))
|
||||
--it;
|
||||
}
|
||||
|
||||
// *** On scope end ***
|
||||
//
|
||||
// on_scope_end provides a way to register some code to be
|
||||
|
Loading…
Reference in New Issue
Block a user