feat: Only show ctrl-s when idle (#1299)

This commit is contained in:
N. Taylor Mullen 2025-06-22 16:57:53 +01:00 committed by GitHub
parent cb76b08e31
commit 3c656cfbc6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 3 deletions

View File

@ -20,7 +20,7 @@
"test:integration:sandbox:docker": "GEMINI_SANDBOX=docker node integration-tests/run-tests.js", "test:integration:sandbox:docker": "GEMINI_SANDBOX=docker node integration-tests/run-tests.js",
"test:integration:sandbox:podman": "GEMINI_SANDBOX=podman node integration-tests/run-tests.js", "test:integration:sandbox:podman": "GEMINI_SANDBOX=podman node integration-tests/run-tests.js",
"start": "node scripts/start.js", "start": "node scripts/start.js",
"debug": "cross-env DEBUG=1 node scripts/start.js", "debug": "cross-env DEBUG=1 node --inspect-brk scripts/start.js",
"lint:fix": "eslint . --fix && eslint integration-tests --fix", "lint:fix": "eslint . --fix && eslint integration-tests --fix",
"lint": "eslint . --ext .ts,.tsx && eslint integration-tests", "lint": "eslint . --ext .ts,.tsx && eslint integration-tests",
"typecheck": "npm run typecheck --workspaces --if-present", "typecheck": "npm run typecheck --workspaces --if-present",

View File

@ -6,6 +6,8 @@
import { Box, Text } from 'ink'; import { Box, Text } from 'ink';
import { useOverflowState } from '../contexts/OverflowContext.js'; import { useOverflowState } from '../contexts/OverflowContext.js';
import { useStreamingContext } from '../contexts/StreamingContext.js';
import { StreamingState } from '../types.js';
import { Colors } from '../colors.js'; import { Colors } from '../colors.js';
interface ShowMoreLinesProps { interface ShowMoreLinesProps {
@ -14,11 +16,16 @@ interface ShowMoreLinesProps {
export const ShowMoreLines = ({ constrainHeight }: ShowMoreLinesProps) => { export const ShowMoreLines = ({ constrainHeight }: ShowMoreLinesProps) => {
const overflowState = useOverflowState(); const overflowState = useOverflowState();
const streamingState = useStreamingContext();
if ( if (
overflowState === undefined || overflowState === undefined ||
overflowState.overflowingIds.size === 0 || overflowState.overflowingIds.size === 0 ||
!constrainHeight !constrainHeight ||
!(
streamingState === StreamingState.Idle ||
streamingState === StreamingState.WaitingForConfirmation
)
) { ) {
return null; return null;
} }
@ -26,7 +33,7 @@ export const ShowMoreLines = ({ constrainHeight }: ShowMoreLinesProps) => {
return ( return (
<Box> <Box>
<Text color={Colors.Gray} wrap="truncate"> <Text color={Colors.Gray} wrap="truncate">
Press Ctrl-S to show more lines Press ctrl-s to show more lines
</Text> </Text>
</Box> </Box>
); );