diff --git a/app/lib/features/terminal/terminal_shortcut_bubble.dart b/app/lib/features/terminal/terminal_shortcut_bubble.dart index 1c36a2ac..88f07b5c 100644 --- a/app/lib/features/terminal/terminal_shortcut_bubble.dart +++ b/app/lib/features/terminal/terminal_shortcut_bubble.dart @@ -4,8 +4,8 @@ import 'package:flutter/material.dart'; import '../../ui/adaptive/segmented_bar_pieces.dart'; /// On a phone, a small floating button below the top bar's right end that -/// reopens the full-screen terminal while a shell is running there. It shows -/// how many shells are running when there is more than one. +/// opens the full-screen terminal. It shows how many shells are running when +/// there is more than one. class TerminalShortcutBubble extends StatelessWidget { const TerminalShortcutBubble({ super.key, @@ -28,9 +28,9 @@ class TerminalShortcutBubble extends StatelessWidget { @override Widget build(BuildContext context) { - final label = running == 1 - ? 'Open terminal' - : 'Open terminal, $running running'; + final label = running > 1 + ? 'Open terminal, $running running' + : 'Open terminal'; final icon = Icon( cupertino ? CupertinoIcons.chevron_left_slash_chevron_right diff --git a/app/lib/features/terminal/terminal_surface.dart b/app/lib/features/terminal/terminal_surface.dart index 238ceada..47d615df 100644 --- a/app/lib/features/terminal/terminal_surface.dart +++ b/app/lib/features/terminal/terminal_surface.dart @@ -187,12 +187,13 @@ class _TerminalSurfaceState extends State if (mounted) setState(() {}); } - /// Running shells on a phone with the terminal page closed get a small - /// shortcut below the top bar's right end. The stack is always there so the + /// On a phone, the Chat page offers a small shortcut below the top bar's + /// right end that opens the terminal (starting one at its login prompt when + /// none is open). The stack is always there so the /// app below never remounts when the shortcut comes or goes. Widget _withShortcut(Widget child) { final running = widget.hub.tabs.where((tab) => tab.info.running).length; - final show = widget.shortcutHere && _narrow && running > 0 && !_page.open; + final show = widget.shortcutHere && _narrow && !_page.open; return Stack( fit: StackFit.passthrough, children: [ diff --git a/app/test/features/terminal/terminal_surface_test.dart b/app/test/features/terminal/terminal_surface_test.dart index 91ce9067..244230dc 100644 --- a/app/test/features/terminal/terminal_surface_test.dart +++ b/app/test/features/terminal/terminal_surface_test.dart @@ -297,15 +297,17 @@ void main() { ) async { await pumpApp(tester, size: const Size(390, 800), onChat: false); final bubble = find.byKey(const Key('terminal-shortcut-bubble')); - await tester.tap(find.byTooltip(TerminalToggleButton.label)); - await tester.pumpAndSettle(); - await tester.pageBack(); - await tester.pumpAndSettle(); - expect(hub.tabs, isNotEmpty); expect(bubble, findsNothing, reason: 'not on Pipelines, Runs or Search'); await pumpApp(tester, size: const Size(390, 800)); await tester.pumpAndSettle(); + // Shown on Chat even before any shell runs; tapping opens the terminal. + expect(hub.tabs, isEmpty); expect(bubble, findsOneWidget, reason: 'shown on Chat'); + expect(find.bySemanticsLabel('Open terminal'), findsOneWidget); + await tester.tap(bubble); + await tester.pumpAndSettle(); + expect(find.widgetWithText(AppBar, 'Terminal'), findsOneWidget); + expect(bubble, findsNothing, reason: 'hidden while the page is open'); }); }