home/src/selectors.hh

64 lines
2.2 KiB
C++
Raw Normal View History

#ifndef selectors_hh_INCLUDED
#define selectors_hh_INCLUDED
#include "selection.hh"
#include "unicode.hh"
namespace Kakoune
{
2012-03-07 20:20:32 +01:00
template<bool punctuation_is_word>
Selection select_to_next_word(const Selection& selection);
2012-03-07 20:20:32 +01:00
template<bool punctuation_is_word>
Selection select_to_next_word_end(const Selection& selection);
2012-03-07 20:20:32 +01:00
template<bool punctuation_is_word>
Selection select_to_previous_word(const Selection& selection);
2012-10-08 19:12:09 +02:00
Selection select_line(const Selection& selection);
Selection select_matching(const Selection& selection);
2012-10-08 19:12:09 +02:00
Selection select_to(const Selection& selection,
Codepoint c, int count, bool inclusive);
Selection select_to_reverse(const Selection& selection,
Codepoint c, int count, bool inclusive);
Selection select_to_eol(const Selection& selection);
Selection select_to_eol_reverse(const Selection& selection);
template<bool punctuation_is_word>
Selection select_whole_word(const Selection& selection, bool inner);
2013-04-30 14:21:48 +02:00
Selection select_whole_sentence(const Selection& selection, bool inner);
2013-04-30 14:29:18 +02:00
Selection select_whole_paragraph(const Selection& selection, bool inner);
Selection select_whole_lines(const Selection& selection);
Selection select_whole_buffer(const Selection& selection);
2013-04-16 14:30:11 +02:00
Selection trim_partial_lines(const Selection& selection);
template<bool forward>
Selection select_next_match(const Selection& selection, const Regex& regex);
SelectionList select_all_matches(const Selection& selection,
const Regex& regex);
SelectionList split_selection(const Selection& selection,
const Regex& separator_regex);
enum class SurroundFlags
{
ToBegin = 1,
ToEnd = 2,
Inner = 4
};
constexpr bool operator&(SurroundFlags lhs, SurroundFlags rhs)
{ return (bool)((int)lhs & (int) rhs); }
constexpr SurroundFlags operator|(SurroundFlags lhs, SurroundFlags rhs)
{ return (SurroundFlags)((int)lhs | (int) rhs); }
using CodepointPair = std::pair<Codepoint, Codepoint>;
Selection select_surrounding(const Selection& selection,
const CodepointPair& matching,
SurroundFlags flags);
}
#endif // selectors_hh_INCLUDED