FlagLines: do not create a new local option in window if the option comes from the buffer
This commit is contained in:
parent
c844f6f5cf
commit
dd3a7f739d
|
@ -378,13 +378,16 @@ public:
|
||||||
if (new_lines == 0)
|
if (new_lines == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto lines = m_window.options()[m_option_name].get<std::vector<LineAndFlag>>();
|
const Option& opt = m_window.options()[m_option_name];
|
||||||
|
if (&opt.manager() == &GlobalOptions::instance())
|
||||||
|
return;
|
||||||
|
auto lines = opt.get<std::vector<LineAndFlag>>();
|
||||||
for (auto& line : lines)
|
for (auto& line : lines)
|
||||||
{
|
{
|
||||||
if (std::get<0>(line) > begin.line())
|
if (std::get<0>(line) > begin.line())
|
||||||
std::get<0>(line) += new_lines;
|
std::get<0>(line) += new_lines;
|
||||||
}
|
}
|
||||||
m_window.options().get_local_option(m_option_name).set(lines);
|
opt.manager().get_local_option(m_option_name).set(lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_erase(const BufferIterator& begin, const BufferIterator& end) override
|
void on_erase(const BufferIterator& begin, const BufferIterator& end) override
|
||||||
|
@ -393,13 +396,17 @@ public:
|
||||||
if (removed_lines == 0)
|
if (removed_lines == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto lines = m_window.options()[m_option_name].get<std::vector<LineAndFlag>>();
|
const Option& opt = m_window.options()[m_option_name];
|
||||||
|
// only update
|
||||||
|
if (&opt.manager() == &GlobalOptions::instance())
|
||||||
|
return;
|
||||||
|
auto lines = opt.get<std::vector<LineAndFlag>>();
|
||||||
for (auto& line : lines)
|
for (auto& line : lines)
|
||||||
{
|
{
|
||||||
if (std::get<0>(line) > begin.line())
|
if (std::get<0>(line) > begin.line())
|
||||||
std::get<0>(line) -= removed_lines;
|
std::get<0>(line) -= removed_lines;
|
||||||
}
|
}
|
||||||
m_window.options().get_local_option(m_option_name).set(lines);
|
opt.manager().get_local_option(m_option_name).set(lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user