fix(terminal): prevent focus stealing during text selection#18
Merged
Conversation
When a long-running process outputs data, the terminal view would constantly steal focus back, making it impossible to select and copy text. This happened because updateNSView was calling focusTerminal() on every SwiftUI view update triggered by the activity indicator. Now we check if the terminal already has focus before attempting to focus it, preserving text selection during active output. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
eyelock
pushed a commit
that referenced
this pull request
Jan 19, 2026
This PR reorganizes and improves the terminal card editor with better component usage and clearer organization. ## New Components ### LargeTextInput - Created new reusable component for multi-line text input - Uses TextEditor (not TextField) for stable, non-jumping layout - Fixed height prevents layout shifts during typing - Custom placeholder implementation - Solves form width issues - now uses full available width - Consistent styling with PathInputField and SharedToggle ## Terminal Editor Changes ### Agent Tab → Prompts Tab - Renamed for clearer terminology (agent prompts vs agent tab) - Improved visual hierarchy with status indicators at top ### Status Indicators (Prompts Tab) - Applied StatusIndicator component for MCP Server status - Applied StatusIndicator for Agent Prompts status - Applied StatusIndicator for Confirm External Modifications - Fixed logic: "Terminal allows commands" now shows "Enabled/Disabled" instead of "Installed" (proper semantic distinction) ### Terminal Tab Reorganization - Moved Command Generator from Agent/Prompts tab to Terminal tab - New section: Automation (contains Init Command + Command Generator) - Reordered sections: Terminal → Security → Automation (logical flow) - Command Generator now conditional (only shows when agent prompts enabled) ## Component Improvements ### StatusIndicator Spacing - Increased HStack spacing: 6 → 8 - Increased vertical padding: 4 → 8 - Reduces "squished" appearance, better visual breathing room ## Localization - Added: common.enabled, common.disabled - Added: editor.section.prompts - Updated all 40 language files with translations ## Files Changed New: - Sources/TermQ/Views/Components/LargeTextInput.swift Modified: - Sources/TermQ/Views/CardEditorView.swift (tab reorganization) - Sources/TermQ/Views/Components/StatusIndicator.swift (spacing) - Sources/TermQ/Utilities/Strings.swift - Sources/TermQ/Resources/*/Localizable.strings (40 files) ## Testing - All 521 tests pass - Manual testing verified: - LargeTextInput stable (no jumping during typing) - Full width usage in forms - StatusIndicator spacing improved - Command Generator conditional display works - Terminal tab section order logical - All status messages semantically correct ## Notes - Global Settings > Tools tab will receive StatusIndicator in PR #7 - This maintains PR #6 focus on Terminal Details editor - PR #7 will achieve full consistency across both views Addresses feedback items #17, #18, #20, #21 from parent plan Part of Settings UI Improvements series (PR #6 of 8) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
eyelock
added a commit
that referenced
this pull request
Jan 19, 2026
…74) This PR reorganizes and improves the terminal card editor with better component usage and clearer organization. ## New Components ### LargeTextInput - Created new reusable component for multi-line text input - Uses TextEditor (not TextField) for stable, non-jumping layout - Fixed height prevents layout shifts during typing - Custom placeholder implementation - Solves form width issues - now uses full available width - Consistent styling with PathInputField and SharedToggle ## Terminal Editor Changes ### Agent Tab → Prompts Tab - Renamed for clearer terminology (agent prompts vs agent tab) - Improved visual hierarchy with status indicators at top ### Status Indicators (Prompts Tab) - Applied StatusIndicator component for MCP Server status - Applied StatusIndicator for Agent Prompts status - Applied StatusIndicator for Confirm External Modifications - Fixed logic: "Terminal allows commands" now shows "Enabled/Disabled" instead of "Installed" (proper semantic distinction) ### Terminal Tab Reorganization - Moved Command Generator from Agent/Prompts tab to Terminal tab - New section: Automation (contains Init Command + Command Generator) - Reordered sections: Terminal → Security → Automation (logical flow) - Command Generator now conditional (only shows when agent prompts enabled) ## Component Improvements ### StatusIndicator Spacing - Increased HStack spacing: 6 → 8 - Increased vertical padding: 4 → 8 - Reduces "squished" appearance, better visual breathing room ## Localization - Added: common.enabled, common.disabled - Added: editor.section.prompts - Updated all 40 language files with translations ## Files Changed New: - Sources/TermQ/Views/Components/LargeTextInput.swift Modified: - Sources/TermQ/Views/CardEditorView.swift (tab reorganization) - Sources/TermQ/Views/Components/StatusIndicator.swift (spacing) - Sources/TermQ/Utilities/Strings.swift - Sources/TermQ/Resources/*/Localizable.strings (40 files) ## Testing - All 521 tests pass - Manual testing verified: - LargeTextInput stable (no jumping during typing) - Full width usage in forms - StatusIndicator spacing improved - Command Generator conditional display works - Terminal tab section order logical - All status messages semantically correct ## Notes - Global Settings > Tools tab will receive StatusIndicator in PR #7 - This maintains PR #6 focus on Terminal Details editor - PR #7 will achieve full consistency across both views Addresses feedback items #17, #18, #20, #21 from parent plan Part of Settings UI Improvements series (PR #6 of 8) Co-authored-by: David Collie <support@eyelock.net> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a bug where text selection was impossible during active terminal output.
When a long-running process outputs data, the terminal view would constantly steal focus back via
updateNSView→focusTerminal(), making it impossible to select and copy text.Changes
focusTerminal()Test plan
ping localhost)🤖 Generated with Claude Code