summaryrefslogtreecommitdiff
path: root/src/highlighters.hh
blob: c8f1dd22e7de0f9c56d0a10685c558304159a8b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef highlighters_hh_INCLUDED
#define highlighters_hh_INCLUDED

#include "color.hh"
#include "highlighter.hh"
#include "option.hh"

namespace Kakoune
{

void register_highlighters();

struct InclusiveBufferRange
{
    BufferCoord first, last;
    friend bool operator==(const InclusiveBufferRange& lhs, const InclusiveBufferRange& rhs) = default;
};

String option_to_string(InclusiveBufferRange range);
InclusiveBufferRange option_from_string(Meta::Type<InclusiveBufferRange>, StringView str);

using LineAndSpec = std::tuple<LineCount, String>;
using LineAndSpecList = TimestampedList<LineAndSpec>;

constexpr StringView option_type_name(Meta::Type<LineAndSpecList>)
{
    return "line-specs";
}
void option_update(LineAndSpecList& opt, const Context& context);
void option_list_postprocess(Vector<LineAndSpec, MemoryDomain::Options>& opt);

using RangeAndString = std::tuple<InclusiveBufferRange, String>;
using RangeAndStringList = TimestampedList<RangeAndString>;

constexpr StringView option_type_name(Meta::Type<RangeAndStringList>)
{
    return "range-specs";
}
void option_update(RangeAndStringList& opt, const Context& context);
void option_list_postprocess(Vector<RangeAndString, MemoryDomain::Options>& opt);
bool option_add_from_strings(Vector<RangeAndString, MemoryDomain::Options>& opt, ConstArrayView<String> strs);

}

#endif // highlighters_hh_INCLUDED