diff options
| author | Maxime Coste <mawww@kakoune.org> | 2017-10-12 14:38:19 +0800 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2017-10-12 14:46:15 +0800 |
| commit | 89f016d871c9ccc516e244e8bc594defe3678daf (patch) | |
| tree | 6de4767371edb0c424d0e5e8102c4c9b4f81b15c /src/window.cc | |
| parent | 446085d32b8a7562fd35a9fb7105874343d8715e (diff) | |
Refactor column highlighter to make it more robust
Support arbitrary orders for column highlighters (it was previously
failing when column highlighters were not applied in column order).
Fix show_matching tab handling at the same time (horizontal scrolling,
tab characters and show_matching were behaving badly).
Window highlighting now runs user highlighters, then built-ins for each
phases, instead of running all phases for user highlighters, then all
phases for built-ins.
We now consider unprintable character to be 1-column width as we know
we will display them as "�".
Fixes #1615
Fixes #1023
Diffstat (limited to 'src/window.cc')
| -rw-r--r-- | src/window.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/window.cc b/src/window.cc index c8d86e14..09652a9b 100644 --- a/src/window.cc +++ b/src/window.cc @@ -136,15 +136,18 @@ const DisplayBuffer& Window::update_display_buffer(const Context& context) buffer()[buffer_line].length() : get_byte_to_column(buffer(), tabstop, {buffer_line, m_position.column + m_range.column}); + // The display buffer always has at least one buffer atom, which might be empty if + // beg_byte == end_byte lines.emplace_back(AtomList{ {buffer(), {buffer_line, beg_byte}, {buffer_line, end_byte}} }); } m_display_buffer.compute_range(); BufferRange range{{0,0}, buffer().end_coord()}; for (auto pass : { HighlightPass::Wrap, HighlightPass::Move, HighlightPass::Colorize }) + { m_highlighters.highlight(context, pass, m_display_buffer, range); - for (auto pass : { HighlightPass::Wrap, HighlightPass::Move, HighlightPass::Colorize }) m_builtin_highlighters.highlight(context, pass, m_display_buffer, range); + } m_display_buffer.optimize(); |
