From eee2cb3a6e4b2981d6775bef3658804b6e9873f1 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 18 Dec 2014 23:13:45 +0000 Subject: [PATCH] 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 5f3a477277828f3c698dd844c8df3614b55dd85b. --- README.asciidoc | 4 ---- src/buffer.cc | 19 ++----------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/README.asciidoc b/README.asciidoc index c07b2f475..b8f6f7a18 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -811,10 +811,6 @@ existing hooks are: * +BufOpen+: A buffer for an existing file 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 used for filtering. * +BufWritePost+: Executed just after a buffer is written, filename is diff --git a/src/buffer.cc b/src/buffer.cc index cddf58c73..57a243e94 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -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) { 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(); if (not (m_flags & Flags::NoUndo)) m_current_undo_group.emplace_back(Modification::Insert, coord, real_content); - BufferIterator it{*this, do_insert(pos.coord(), real_content)}; - - run_hook_in_own_context("BufInsert", change_spec(pos.coord(), real_content.length())); - - return it; + return {*this, do_insert(pos.coord(), real_content)}; } BufferIterator Buffer::erase(BufferIterator begin, BufferIterator end) @@ -415,13 +406,7 @@ BufferIterator Buffer::erase(BufferIterator begin, BufferIterator end) if (not (m_flags & Flags::NoUndo)) m_current_undo_group.emplace_back(Modification::Erase, begin.coord(), InternedString(string(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; + return {*this, do_erase(begin.coord(), end.coord())}; } bool Buffer::is_modified() const