From 46a01b5a0b9a87db8509062dad958ea67f275395 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 28 Nov 2011 18:52:29 +0000 Subject: [PATCH] Debug: stop writing key codes to debug buffer and cleanups --- src/debug.cc | 4 ++-- src/main.cc | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/debug.cc b/src/debug.cc index 2aa7b1794..8fbc5b41d 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -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); } } diff --git a/src/main.cc b/src/main.cc index 9971d4c49..2b1ca02e5 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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