From c183acb800057cdbd0d7f1e8965190f912613d4c Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 6 Mar 2012 23:12:48 +0000 Subject: [PATCH] use an Editor in write_debug --- src/debug.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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); } }