Debug: stop writing key codes to debug buffer and cleanups

This commit is contained in:
Maxime Coste 2011-11-28 18:52:29 +00:00
parent dc642f8afa
commit 46a01b5a0b
2 changed files with 4 additions and 6 deletions

View File

@ -12,7 +12,7 @@ static Buffer& get_or_create_debug_buffer()
Buffer* buffer = BufferManager::instance().get_buffer(debug_buffer_name);
if (not buffer)
buffer = new Buffer(debug_buffer_name, Buffer::Type::Scratch);
buffer = new Buffer(debug_buffer_name, Buffer::Type::Scratch, "\n");
assert(buffer);
return *buffer;
@ -21,7 +21,7 @@ static Buffer& get_or_create_debug_buffer()
void write_debug(const std::string& str)
{
Buffer& debug_buffer = get_or_create_debug_buffer();
debug_buffer.insert(debug_buffer.end(), str);
debug_buffer.insert(debug_buffer.end()-1, str);
}
}

View File

@ -724,6 +724,8 @@ int main(int argc, char* argv[])
try
{
write_debug("*** This is the debug buffer, where debug info will be written ***\n");
auto buffer = (argc > 1) ? open_or_create(argv[1]) : new Buffer("*scratch*", Buffer::Type::Scratch);
main_context = Context(*buffer->get_or_create_window());
@ -735,10 +737,6 @@ int main(int argc, char* argv[])
{
char c = getch();
std::ostringstream oss;
oss << "key " << int(c) << " (" << c << ")\n";
write_debug(oss.str());
if (isdigit(c))
count = count * 10 + c - '0';
else