[Haiku-commits] r30953 - haiku/trunk/src/system/kernel/debug

axeld at BerliOS axeld at mail.berlios.de
Wed Jun 3 23:05:29 CEST 2009


Author: axeld
Date: 2009-06-03 23:05:29 +0200 (Wed, 03 Jun 2009)
New Revision: 30953
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30953&view=rev

Modified:
   haiku/trunk/src/system/kernel/debug/debug.cpp
Log:
* Don't overwrite the history buffer when you issue the same command more than
  once.


Modified: haiku/trunk/src/system/kernel/debug/debug.cpp
===================================================================
--- haiku/trunk/src/system/kernel/debug/debug.cpp	2009-06-03 20:36:29 UTC (rev 30952)
+++ haiku/trunk/src/system/kernel/debug/debug.cpp	2009-06-03 21:05:29 UTC (rev 30953)
@@ -714,14 +714,23 @@
 
 		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);




More information about the Haiku-commits mailing list