memspy/Engine/Source/Sink/MemSpyEngineOutputList.cpp
branchRCL_3
changeset 49 7fdc9a71d314
parent 44 52e343bb8f80
child 59 8ad140f3dd41
--- a/memspy/Engine/Source/Sink/MemSpyEngineOutputList.cpp	Wed Sep 15 00:19:18 2010 +0300
+++ b/memspy/Engine/Source/Sink/MemSpyEngineOutputList.cpp	Wed Sep 15 13:53:27 2010 +0300
@@ -102,8 +102,18 @@
         for( TInt j=0; j<count; j++ )
             {
             const CMemSpyEngineOutputListItem* item = iItems[ j ];
-            maxLengthCaption = Max( maxLengthCaption, item->Caption().Length() );
-            maxLengthValue = Max( maxLengthValue, item->Value().Length() );
+			if (item->Value().Length())
+				{
+	            maxLengthCaption = Max( maxLengthCaption, item->Caption().Length() );
+	            maxLengthValue = Max( maxLengthValue, item->Value().Length() );
+				}
+			else
+				{
+				// If something doesn't have a value (ie it's a section header, represented as just a caption) then the caption
+				// shouldn't be factored into the maxcaptionlength. But consider it in maxlengthValue to make sure we actually
+				// make the overall buffers big enough
+				maxLengthValue = Max( maxLengthValue, item->Caption().Length() );
+				}
             }
 
         // Second pass - real this time - to print the values
@@ -121,7 +131,15 @@
             HBufC* value = MemSpyEngineUtils::CleanupTextLC( item->Value() );
 
             // Now format the final line, with padding.
-            pLine.Justify( *caption, maxLengthCaption + 3, ELeft, TChar(' ') );
+			if (value->Length()) 
+				{
+	            pLine.Justify( *caption, maxLengthCaption + 3, ELeft, TChar(' ') );
+				}
+			else
+				{
+				// items without value (ie just captions, ie section headers) aren't constrained by the maxLengthCaption restriction
+				pLine.Copy(*caption);
+				}
             pLine.Append( *value );
             CleanupStack::PopAndDestroy( 2, caption );