mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-30 23:37:17 +03:00
Pass DisplaySetup through the HighlightContext
This commit is contained in:
parent
3208bc3762
commit
60cf71bc24
@ -56,6 +56,7 @@ using HighlighterIdList = ConstArrayView<StringView>;
|
||||
struct HighlightContext
|
||||
{
|
||||
const Context& context;
|
||||
const DisplaySetup& setup;
|
||||
HighlightPass pass;
|
||||
HighlighterIdList disabled_ids;
|
||||
};
|
||||
|
@ -80,7 +80,7 @@ void Highlighters::highlight(HighlightContext context, DisplayBuffer& display_bu
|
||||
m_group.fill_unique_ids(disabled_ids);
|
||||
|
||||
if (m_parent)
|
||||
m_parent->highlight({context.context, context.pass, disabled_ids}, display_buffer, range);
|
||||
m_parent->highlight({context.context, context.setup, context.pass, disabled_ids}, display_buffer, range);
|
||||
m_group.highlight(context, display_buffer, range);
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ void Highlighters::compute_display_setup(HighlightContext context, DisplaySetup&
|
||||
m_group.fill_unique_ids(disabled_ids);
|
||||
|
||||
if (m_parent)
|
||||
m_parent->compute_display_setup({context.context, context.pass, disabled_ids}, setup);
|
||||
m_parent->compute_display_setup({context.context, context.setup, context.pass, disabled_ids}, setup);
|
||||
m_group.compute_display_setup(context, setup);
|
||||
}
|
||||
|
||||
|
@ -601,7 +601,7 @@ HighlighterAndId create_column_highlighter(HighlighterParameters params)
|
||||
return;
|
||||
|
||||
auto face = context.context.faces()[facespec];
|
||||
auto win_column = context.context.window().position().column;
|
||||
auto win_column = context.setup.window_pos.column;
|
||||
for (auto& line : display_buffer.lines())
|
||||
{
|
||||
auto target_col = column - win_column;
|
||||
@ -651,7 +651,7 @@ struct WrapHighlighter : Highlighter
|
||||
if (contains(context.disabled_ids, ms_id))
|
||||
return;
|
||||
|
||||
const ColumnCount wrap_column = std::min(m_max_width, context.context.window().range().column);
|
||||
const ColumnCount wrap_column = std::min(m_max_width, context.setup.window_range.column);
|
||||
if (wrap_column <= 0)
|
||||
return;
|
||||
|
||||
@ -889,7 +889,7 @@ struct TabulationHighlighter : Highlighter
|
||||
{
|
||||
const ColumnCount tabstop = context.context.options()["tabstop"].get<int>();
|
||||
auto& buffer = context.context.buffer();
|
||||
auto win_column = context.context.window().position().column;
|
||||
auto win_column = context.setup.window_pos.column;
|
||||
for (auto& line : display_buffer.lines())
|
||||
{
|
||||
for (auto atom_it = line.begin(); atom_it != line.end(); ++atom_it)
|
||||
@ -945,7 +945,7 @@ void show_whitespaces(HighlightContext context, DisplayBuffer& display_buffer, B
|
||||
const int tabstop = context.context.options()["tabstop"].get<int>();
|
||||
auto whitespaceface = context.context.faces()["Whitespace"];
|
||||
auto& buffer = context.context.buffer();
|
||||
auto win_column = context.context.window().position().column;
|
||||
auto win_column = context.setup.window_pos.column;
|
||||
for (auto& line : display_buffer.lines())
|
||||
{
|
||||
for (auto atom_it = line.begin(); atom_it != line.end(); ++atom_it)
|
||||
|
@ -158,7 +158,7 @@ const DisplayBuffer& Window::update_display_buffer(const Context& context)
|
||||
m_display_buffer.compute_range();
|
||||
BufferRange range{{0,0}, buffer().end_coord()};
|
||||
for (auto pass : { HighlightPass::Wrap, HighlightPass::Move, HighlightPass::Colorize })
|
||||
m_builtin_highlighters.highlight({context, pass, {}}, m_display_buffer, range);
|
||||
m_builtin_highlighters.highlight({context, setup, pass, {}}, m_display_buffer, range);
|
||||
|
||||
m_display_buffer.optimize();
|
||||
|
||||
@ -225,7 +225,7 @@ DisplaySetup Window::compute_display_setup(const Context& context) const
|
||||
false
|
||||
};
|
||||
for (auto pass : { HighlightPass::Move, HighlightPass::Wrap })
|
||||
m_builtin_highlighters.compute_display_setup({context, pass, {}}, setup);
|
||||
m_builtin_highlighters.compute_display_setup({context, setup, pass, {}}, setup);
|
||||
check_display_setup(setup, *this);
|
||||
|
||||
// now ensure the cursor column is visible
|
||||
|
Loading…
Reference in New Issue
Block a user