mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-26 21:22:00 +03:00
Refactor write_debug to avoid empty first line in *debug* buffer
This commit is contained in:
parent
ca9baecd4c
commit
c279da14e3
14
src/debug.cc
14
src/debug.cc
@ -17,13 +17,13 @@ void write_debug(StringView str)
|
||||
}
|
||||
|
||||
const StringView debug_buffer_name = "*debug*";
|
||||
Buffer* buffer = BufferManager::instance().get_buffer_ifp(debug_buffer_name);
|
||||
|
||||
if (not buffer)
|
||||
buffer = new Buffer(debug_buffer_name, Buffer::Flags::NoUndo);
|
||||
|
||||
kak_assert(buffer);
|
||||
buffer->insert(buffer->end(), str);
|
||||
if (Buffer* buffer = BufferManager::instance().get_buffer_ifp(debug_buffer_name))
|
||||
buffer->insert(buffer->end(), str);
|
||||
else
|
||||
{
|
||||
String line = str + ((str.empty() or str.back() != '\n') ? "\n" : "");
|
||||
new Buffer(debug_buffer_name, Buffer::Flags::NoUndo, { line });
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user