Revert "Add support for BufInsert/BufErase hooks"
This is potentially quite slow, and not used, reintroduce
later if we have a use case for it.
This reverts commit 5f3a477277
.
This commit is contained in:
parent
1c8ee78d1a
commit
eee2cb3a6e
|
@ -811,10 +811,6 @@ existing hooks are:
|
||||||
* +BufOpen+: A buffer for an existing file has been created, filename is
|
* +BufOpen+: A buffer for an existing file has been created, filename is
|
||||||
used for filtering
|
used for filtering
|
||||||
* +BufCreate+: A buffer has been created, filename is used for filtering
|
* +BufCreate+: A buffer has been created, filename is used for filtering
|
||||||
* +BufInsert+: An insertion just took place in a buffer, filtering string
|
|
||||||
is 'line.column+len'
|
|
||||||
* +BufErase+: An erase just took place in a buffer, filtering string
|
|
||||||
is 'line.column+len'
|
|
||||||
* +BufWritePre+: Executed just before a buffer is written, filename is
|
* +BufWritePre+: Executed just before a buffer is written, filename is
|
||||||
used for filtering.
|
used for filtering.
|
||||||
* +BufWritePost+: Executed just after a buffer is written, filename is
|
* +BufWritePost+: Executed just after a buffer is written, filename is
|
||||||
|
|
|
@ -374,11 +374,6 @@ void Buffer::apply_modification(const Modification& modification)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static String change_spec(ByteCoord coord, ByteCount len)
|
|
||||||
{
|
|
||||||
return to_string(coord.line) + "." + to_string(coord.column) + "+" + to_string(len);
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferIterator Buffer::insert(const BufferIterator& pos, StringView content)
|
BufferIterator Buffer::insert(const BufferIterator& pos, StringView content)
|
||||||
{
|
{
|
||||||
kak_assert(is_valid(pos.coord()));
|
kak_assert(is_valid(pos.coord()));
|
||||||
|
@ -396,11 +391,7 @@ BufferIterator Buffer::insert(const BufferIterator& pos, StringView content)
|
||||||
auto coord = pos == end() ? ByteCoord{line_count()} : pos.coord();
|
auto coord = pos == end() ? ByteCoord{line_count()} : pos.coord();
|
||||||
if (not (m_flags & Flags::NoUndo))
|
if (not (m_flags & Flags::NoUndo))
|
||||||
m_current_undo_group.emplace_back(Modification::Insert, coord, real_content);
|
m_current_undo_group.emplace_back(Modification::Insert, coord, real_content);
|
||||||
BufferIterator it{*this, do_insert(pos.coord(), real_content)};
|
return {*this, do_insert(pos.coord(), real_content)};
|
||||||
|
|
||||||
run_hook_in_own_context("BufInsert", change_spec(pos.coord(), real_content.length()));
|
|
||||||
|
|
||||||
return it;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferIterator Buffer::erase(BufferIterator begin, BufferIterator end)
|
BufferIterator Buffer::erase(BufferIterator begin, BufferIterator end)
|
||||||
|
@ -415,13 +406,7 @@ BufferIterator Buffer::erase(BufferIterator begin, BufferIterator end)
|
||||||
if (not (m_flags & Flags::NoUndo))
|
if (not (m_flags & Flags::NoUndo))
|
||||||
m_current_undo_group.emplace_back(Modification::Erase, begin.coord(),
|
m_current_undo_group.emplace_back(Modification::Erase, begin.coord(),
|
||||||
InternedString(string(begin.coord(), end.coord())));
|
InternedString(string(begin.coord(), end.coord())));
|
||||||
|
return {*this, do_erase(begin.coord(), end.coord())};
|
||||||
ByteCount len = distance(begin.coord(), end.coord());
|
|
||||||
BufferIterator it{*this, do_erase(begin.coord(), end.coord())};
|
|
||||||
|
|
||||||
run_hook_in_own_context("BufErase", change_spec(begin.coord(), len));
|
|
||||||
|
|
||||||
return it;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Buffer::is_modified() const
|
bool Buffer::is_modified() const
|
||||||
|
|
Loading…
Reference in New Issue
Block a user