use an Editor in write_debug
This commit is contained in:
parent
c99a6a3e4c
commit
c183acb800
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "assert.hh"
|
#include "assert.hh"
|
||||||
#include "buffer_manager.hh"
|
#include "buffer_manager.hh"
|
||||||
|
#include "editor.hh"
|
||||||
|
|
||||||
namespace Kakoune
|
namespace Kakoune
|
||||||
{
|
{
|
||||||
|
@ -12,7 +13,7 @@ static Buffer& get_or_create_debug_buffer()
|
||||||
Buffer* buffer = BufferManager::instance().get_buffer(debug_buffer_name);
|
Buffer* buffer = BufferManager::instance().get_buffer(debug_buffer_name);
|
||||||
|
|
||||||
if (not buffer)
|
if (not buffer)
|
||||||
buffer = new Buffer(debug_buffer_name, Buffer::Type::Scratch, "\n");
|
buffer = new Buffer(debug_buffer_name, Buffer::Type::Scratch, "");
|
||||||
|
|
||||||
assert(buffer);
|
assert(buffer);
|
||||||
return *buffer;
|
return *buffer;
|
||||||
|
@ -21,7 +22,9 @@ static Buffer& get_or_create_debug_buffer()
|
||||||
void write_debug(const std::string& str)
|
void write_debug(const std::string& str)
|
||||||
{
|
{
|
||||||
Buffer& debug_buffer = get_or_create_debug_buffer();
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user