2011-10-07 16:16:38 +02:00
|
|
|
#include "debug.hh"
|
|
|
|
|
|
|
|
#include "assert.hh"
|
2013-12-20 21:10:08 +01:00
|
|
|
#include "buffer.hh"
|
2011-10-07 16:16:38 +02:00
|
|
|
#include "buffer_manager.hh"
|
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
|
|
|
static Buffer& get_or_create_debug_buffer()
|
|
|
|
{
|
2012-04-14 03:17:09 +02:00
|
|
|
static const String debug_buffer_name("*debug*");
|
2013-03-21 19:09:31 +01:00
|
|
|
Buffer* buffer = BufferManager::instance().get_buffer_ifp(debug_buffer_name);
|
2011-10-07 16:16:38 +02:00
|
|
|
|
|
|
|
if (not buffer)
|
2012-11-21 13:43:10 +01:00
|
|
|
buffer = new Buffer(debug_buffer_name, Buffer::Flags::NoUndo);
|
2011-10-07 16:16:38 +02:00
|
|
|
|
2013-04-09 20:04:11 +02:00
|
|
|
kak_assert(buffer);
|
2011-10-07 16:16:38 +02:00
|
|
|
return *buffer;
|
|
|
|
}
|
|
|
|
|
2012-04-14 03:17:09 +02:00
|
|
|
void write_debug(const String& str)
|
2011-10-07 16:16:38 +02:00
|
|
|
{
|
2013-12-14 19:38:14 +01:00
|
|
|
Buffer& buffer = get_or_create_debug_buffer();
|
|
|
|
buffer.insert(buffer.end(), str);
|
2011-10-07 16:16:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|