From cf2a26ea962ac658872caa62ac5cebe15d88c0f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 3 Jun 2009 21:05:29 +0000 Subject: [PATCH] * Don't overwrite the history buffer when you issue the same command more than once. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30953 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/debug/debug.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/system/kernel/debug/debug.cpp b/src/system/kernel/debug/debug.cpp index 1b54086448..aa3dca682f 100644 --- a/src/system/kernel/debug/debug.cpp +++ b/src/system/kernel/debug/debug.cpp @@ -714,14 +714,23 @@ kernel_debugger_loop(void) int rc = evaluate_debug_command(line); - if (rc == B_KDEBUG_QUIT) - break; // okay, exit now. + if (rc == B_KDEBUG_QUIT) { + // okay, exit now. + break; + } // If the command is continuable, remember the current line index. continuableLine = (rc == B_KDEBUG_CONT ? sCurrentLine : -1); - if (++sCurrentLine >= HISTORY_SIZE) - sCurrentLine = 0; + int previousLine = sCurrentLine - 1; + if (previousLine < 0) + previousLine = HISTORY_SIZE - 1; + + // Only use the next slot in the history, if the entries differ + if (strcmp(sLineBuffer[sCurrentLine], sLineBuffer[previousLine])) { + if (++sCurrentLine >= HISTORY_SIZE) + sCurrentLine = 0; + } } delete_debug_alloc_pool(allocPool);