2011-10-07 16:16:38 +02:00
|
|
|
#include "debug.hh"
|
|
|
|
|
|
|
|
#include "assert.hh"
|
|
|
|
#include "buffer_manager.hh"
|
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
|
|
|
static Buffer& get_or_create_debug_buffer()
|
|
|
|
{
|
|
|
|
static const std::string debug_buffer_name("*debug*");
|
|
|
|
Buffer* buffer = BufferManager::instance().get_buffer(debug_buffer_name);
|
|
|
|
|
|
|
|
if (not buffer)
|
2011-11-28 19:52:29 +01:00
|
|
|
buffer = new Buffer(debug_buffer_name, Buffer::Type::Scratch, "\n");
|
2011-10-07 16:16:38 +02:00
|
|
|
|
|
|
|
assert(buffer);
|
|
|
|
return *buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
void write_debug(const std::string& str)
|
|
|
|
{
|
|
|
|
Buffer& debug_buffer = get_or_create_debug_buffer();
|
2011-12-07 15:26:40 +01:00
|
|
|
debug_buffer.modify(Modification::make_insert(debug_buffer.end()-1, str));
|
2011-10-07 16:16:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|