diff options
| author | Maxime Coste <mawww@kakoune.org> | 2018-10-21 12:10:21 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2018-10-21 12:10:21 +1100 |
| commit | 72bdd7900f5366ff9e99e78baf9c3bd32e0d51e8 (patch) | |
| tree | bb69176c4846d007d0b94075e92bc541a5592588 /src/line_modification.hh | |
| parent | 7dbca46bf021583df8edfa20451a8121ca78293e (diff) | |
Move LineRangeSet to line_modification.hh
Diffstat (limited to 'src/line_modification.hh')
| -rw-r--r-- | src/line_modification.hh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/line_modification.hh b/src/line_modification.hh index 7c21503c..cdc601df 100644 --- a/src/line_modification.hh +++ b/src/line_modification.hh @@ -1,8 +1,10 @@ #ifndef line_change_watcher_hh_INCLUDED #define line_change_watcher_hh_INCLUDED +#include "array_view.hh" #include "units.hh" #include "utils.hh" +#include "range.hh" #include "vector.hh" namespace Kakoune @@ -22,6 +24,25 @@ struct LineModification Vector<LineModification> compute_line_modifications(const Buffer& buffer, size_t timestamp); +using LineRange = Range<LineCount>; + +struct LineRangeSet : private Vector<LineRange, MemoryDomain::Highlight> +{ + using Base = Vector<LineRange, MemoryDomain::Highlight>; + using Base::operator[]; + using Base::begin; + using Base::end; + + ConstArrayView<LineRange> view() const { return {data(), data() + size()}; } + + void reset(LineRange range) { Base::operator=({range}); } + + void update(ConstArrayView<LineModification> modifs); + void add_range(LineRange range, std::function<void (LineRange)> on_new_range); + void remove_range(LineRange range); +}; + + } #endif // line_change_watcher_hh_INCLUDED |
