diff --git a/src/debug.cc b/src/debug.cc index 4fe802bf..d170f843 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -2,6 +2,7 @@ #include "assert.hh" #include "buffer_manager.hh" +#include "editor.hh" namespace Kakoune { @@ -12,7 +13,7 @@ static Buffer& get_or_create_debug_buffer() Buffer* buffer = BufferManager::instance().get_buffer(debug_buffer_name); if (not buffer) - buffer = new Buffer(debug_buffer_name, Buffer::Type::Scratch, "\n"); + buffer = new Buffer(debug_buffer_name, Buffer::Type::Scratch, ""); assert(buffer); return *buffer; @@ -21,7 +22,9 @@ static Buffer& get_or_create_debug_buffer() void write_debug(const std::string& str) { Buffer& debug_buffer = get_or_create_debug_buffer(); - debug_buffer.modify(Modification::make_insert(debug_buffer.end()-1, str)); + Editor editor(debug_buffer); + editor.select(debug_buffer.end()); + editor.insert(str); } }