diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-12-12 19:33:29 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-12-13 18:50:27 +0100 |
| commit | bf07d2576ea7ea80e45a6e73b6a61d47f2fffb9f (patch) | |
| tree | 2a3cab108a4d4b78dbeb191f57f68c6750ee9776 /src | |
| parent | 52f63b96b6b54cad1267e65e695fc95babf70cf4 (diff) | |
minor refactoring in highlight_range
Diffstat (limited to 'src')
| -rw-r--r-- | src/highlighters.cc | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/highlighters.cc b/src/highlighters.cc index ba2a74af..c96364ba 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -24,31 +24,31 @@ void highlight_range(DisplayBuffer& display_buffer, for (auto& line : display_buffer.lines()) { - if (line.buffer_line() >= begin.line() and line.buffer_line() <= end.line()) + if (line.buffer_line() < begin.line() or end.line() < line.buffer_line()) + continue; + + for (auto atom_it = line.begin(); atom_it != line.end(); ++atom_it) { - for (auto atom_it = line.begin(); atom_it != line.end(); ++atom_it) - { - bool is_replaced = atom_it->content.type() == AtomContent::ReplacedBufferRange; + bool is_replaced = atom_it->content.type() == AtomContent::ReplacedBufferRange; - if (not atom_it->content.has_buffer_range() or - (skip_replaced and is_replaced)) - continue; + if (not atom_it->content.has_buffer_range() or + (skip_replaced and is_replaced)) + continue; - if (end <= atom_it->content.begin() or begin >= atom_it->content.end()) - continue; + if (end <= atom_it->content.begin() or begin >= atom_it->content.end()) + continue; - if (not is_replaced and begin > atom_it->content.begin()) - atom_it = ++line.split(atom_it, begin); + if (not is_replaced and begin > atom_it->content.begin()) + atom_it = ++line.split(atom_it, begin); - if (not is_replaced and end < atom_it->content.end()) - { - atom_it = line.split(atom_it, end); - func(*atom_it); - ++atom_it; - } - else - func(*atom_it); + if (not is_replaced and end < atom_it->content.end()) + { + atom_it = line.split(atom_it, end); + func(*atom_it); + ++atom_it; } + else + func(*atom_it); } } } |
