From 7c4a5464f68db32bb0069927f65deb2a61bd094f Mon Sep 17 00:00:00 2001
From: Olcan <olcans@gmail.com>
Date: Fri, 30 May 2025 01:58:09 -0700
Subject: truncate (hide) tool output at the top, add some spacing, also fix
 shell output interval change accidentally undone in a previous commit (#619)

---
 .../cli/src/ui/components/messages/ToolMessage.tsx   | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

(limited to 'packages/cli/src/ui/components/messages/ToolMessage.tsx')

diff --git a/packages/cli/src/ui/components/messages/ToolMessage.tsx b/packages/cli/src/ui/components/messages/ToolMessage.tsx
index 922f59d0..51d3dffb 100644
--- a/packages/cli/src/ui/components/messages/ToolMessage.tsx
+++ b/packages/cli/src/ui/components/messages/ToolMessage.tsx
@@ -47,7 +47,7 @@ export const ToolMessage: React.FC<ToolMessageProps> = ({
   const displayableResult = React.useMemo(
     () =>
       resultIsString
-        ? lines.slice(0, contentHeightEstimate).join('\n')
+        ? lines.slice(-contentHeightEstimate).join('\n')
         : resultDisplay,
     [lines, resultIsString, contentHeightEstimate, resultDisplay],
   );
@@ -66,8 +66,16 @@ export const ToolMessage: React.FC<ToolMessageProps> = ({
         {emphasis === 'high' && <TrailingIndicator />}
       </Box>
       {displayableResult && (
-        <Box paddingLeft={STATUS_INDICATOR_WIDTH} width="100%">
+        <Box paddingLeft={STATUS_INDICATOR_WIDTH} width="100%" marginTop={1}>
           <Box flexDirection="column">
+            {hiddenLines > 0 && (
+              <Box>
+                <Text color={Colors.SubtleComment}>
+                  ... first {hiddenLines} line{hiddenLines === 1 ? '' : 's'}{' '}
+                  hidden ...
+                </Text>
+              </Box>
+            )}
             {typeof displayableResult === 'string' && (
               <Box flexDirection="column">
                 <MarkdownDisplay
@@ -83,14 +91,6 @@ export const ToolMessage: React.FC<ToolMessageProps> = ({
                 filename={displayableResult.fileName}
               />
             )}
-            {hiddenLines > 0 && (
-              <Box>
-                <Text color={Colors.SubtleComment}>
-                  ... {hiddenLines} more line{hiddenLines === 1 ? '' : 's'}{' '}
-                  hidden ...
-                </Text>
-              </Box>
-            )}
           </Box>
         </Box>
       )}
-- 
cgit v1.2.3

