diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2013-01-07 18:53:27 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2013-01-07 18:53:27 +0100 |
| commit | 3f7bf82cdeb68bd3e73dcff4545bf23045fcfb73 (patch) | |
| tree | 564d68ed7a0d169f0e48ef18ea74ae9af75bdc62 /src/selectors.hh | |
| parent | 4fc598cd48af95b66bf3b3351b39b5a348ccc58d (diff) | |
Support for selecting to surrounding object begin/end with [ and ]
Diffstat (limited to 'src/selectors.hh')
| -rw-r--r-- | src/selectors.hh | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/selectors.hh b/src/selectors.hh index 806c27ac..2026cb4d 100644 --- a/src/selectors.hh +++ b/src/selectors.hh @@ -2,7 +2,7 @@ #define selectors_hh_INCLUDED #include "selection.hh" -#include "utf8.hh" +#include "unicode.hh" namespace Kakoune { @@ -17,10 +17,6 @@ Selection select_to_previous_word(const Selection& selection); Selection select_line(const Selection& selection); Selection select_matching(const Selection& selection); -using CodepointPair = std::pair<Codepoint, Codepoint>; -Selection select_surrounding(const Selection& selection, - const CodepointPair& matching, bool inside); - Selection select_to(const Selection& selection, Codepoint c, int count, bool inclusive); Selection select_to_reverse(const Selection& selection, @@ -43,6 +39,22 @@ SelectionList select_all_matches(const Selection& selection, SelectionList split_selection(const Selection& selection, const String& 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 |
