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*";
|
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);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user