1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-27 13:44:32 +03:00

Refactor write_debug to avoid empty first line in *debug* buffer

This commit is contained in:
Maxime Coste 2015-01-05 09:38:40 +00:00
parent ca9baecd4c
commit c279da14e3

View File

@ -17,13 +17,13 @@ void write_debug(StringView str)
} }
const StringView debug_buffer_name = "*debug*"; const StringView debug_buffer_name = "*debug*";
Buffer* buffer = BufferManager::instance().get_buffer_ifp(debug_buffer_name); if (Buffer* buffer = BufferManager::instance().get_buffer_ifp(debug_buffer_name))
buffer->insert(buffer->end(), str);
if (not buffer) else
buffer = new Buffer(debug_buffer_name, Buffer::Flags::NoUndo); {
String line = str + ((str.empty() or str.back() != '\n') ? "\n" : "");
kak_assert(buffer); new Buffer(debug_buffer_name, Buffer::Flags::NoUndo, { line });
buffer->insert(buffer->end(), str); }
} }
} }