Conversation
Right-clicking on a tab now shows a context menu with options: - Close Tab: Closes the clicked tab - Move to New Window: Opens a new window and closes the tab Implementation: - Added onContextMenu callback to TabItem with right-click detection - Added onTabMoveToNewWindow callback to TabBar - Wired up callbacks in TabbedTerminal to create new window and close tab 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
When using "Move to New Window" from tab context menu, the terminal session (PTY process, history, state) is now preserved and transferred to the new window instead of being destroyed. Implementation: - Added WindowManager.pendingTabForNewWindow to hold tab during transfer - Added WindowManager.createWindowWithTab() to initiate transfer - Added TabController.extractTab() to remove tab without disposing - Updated TabbedTerminal to check for pending tab on initialization - Updated onTabMoveToNewWindow to use extraction instead of disposal The tab's PTY process continues running, scrollback history is preserved, and the terminal state is maintained during the transfer. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Previously, only the focused pane was transferred to a new window. Now the entire SplitViewState is extracted and restored in the new window, preserving the complete split terminal layout. Changes: - WindowManager: Added pendingSplitStateForNewWindow storage - TabbedTerminal: Extract split state in onTabMoveToNewWindow callback - TabbedTerminal: Restore split state when initializing from pending tab 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Right-click on a tab now shows: - New Tab - (separator) - Close Tab - Move to New Window 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Right-click on terminal area now includes "New Tab" option between the split pane options and settings. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When right-clicking on an unfocused window, the context menu would appear in a detached state and not dismiss properly. Now the code: 1. Finds the window at the mouse position if no window is focused 2. Requests focus on that window before showing the popup 3. Properly attaches the popup to the window for correct dismiss behavior 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code Review - PR #102: Tab Management & Context Menu ImprovementsSummaryThis PR implements several important UX improvements: tab transfer between windows, context menu fixes, and cursor/scroll behavior enhancements. Overall, the implementation is well-structured with clear separation of concerns. ✅ Strengths1. Clean Architecture for Tab Transfer
2. Smart State Management
3. Context Menu Focus Fix
|
Reduced default scrollbar width from 12px to 8px for a cleaner look. Users can still adjust via Settings → Scrollbar → Scrollbar Width (6-20px). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Pull Request Review: Tab Management and Context Menu ImprovementsOverviewThis PR adds significant improvements to tab management and context menus, with the headline feature being tab transfer between windows. The implementation is generally solid with good separation of concerns, though there are some potential issues to address. 🟢 Strengths1. Clean Architecture for Tab TransferThe window-to-window tab transfer design is elegant:
2. Proper Resource Management
// Remove from list without disposing
tabs.removeAt(index)
// (No dispose(), no PTY kill, no listener notification)3. Context Menu RobustnessThe fix for unfocused window context menus is well-thought-out:
4. Consistent UX AdditionsAdding "New Tab" to both tab bar and terminal area context menus is good UX consistency. 🟡 Issues to Address1. Race Condition in WindowManager (CRITICAL)Location: Problem: The singleton pattern with mutable state is not thread-safe: var pendingTabForNewWindow: TerminalTab? = null
var pendingSplitStateForNewWindow: SplitViewState? = nullScenario:
Recommendation: private val _pendingTabs = mutableMapOf<String, Pair<TerminalTab, SplitViewState?>>()
fun createWindowWithTab(tab: TerminalTab, splitState: SplitViewState? = null): TerminalWindow {
val windowId = UUID.randomUUID().toString()
_pendingTabs[windowId] = tab to splitState
val window = TerminalWindow(id = windowId)
_windows.add(window)
return window
}
fun consumePendingTab(windowId: String): Pair<TerminalTab, SplitViewState?>? {
return _pendingTabs.remove(windowId)
}2. Missing Null Safety in Tab TransferLocation: val tab = tabController.tabs.getOrNull(index) ?: return@TabBarThis handles null tab, but Fix: Combine the operations: onTabMoveToNewWindow = { index ->
val extractedTab = tabController.extractTab(index) ?: return@TabBar
val splitState = splitStates.remove(extractedTab.id)
WindowManager.createWindowWithTab(extractedTab, splitState)
}3. Context Menu Focus Side EffectsLocation: targetWindow?.toFront()
targetWindow?.requestFocus()Problem: This unconditionally brings an unfocused window to front when right-clicking. This might be surprising UX:
Recommendation: Only bring to front if absolutely necessary for menu dismiss, or document this as intentional behavior. 4. Missing Resource Cleanup PathLocation: If a window creation fails (e.g., exception during Recommendation: Add cleanup on window creation failure or use the map-based approach from Issue #1 which naturally handles this. 5. Scrollbar Thickness Change (MINOR)Location: Multiple files - Changing default scrollbar thickness from 12px to 8px is unrelated to tab management. Consider:
🔵 Code Quality Observations1. Good DocumentationThe KDoc for 2. Consistent PatternsThe tab switching logic in 3. Missing Unit TestsGiven the complexity of window-to-window tab transfer (state management, resource ownership, race conditions), this feature would benefit from unit tests:
🔴 Security/Performance Concerns1. Performance: Linear Window SearchLocation: Window.getWindows()
.filter { it.isVisible && it.bounds.contains(mousePoint) }
.maxByOrNull { it.bounds.width * it.bounds.height }This is O(n) on every right-click. For typical usage (1-5 windows), this is fine. But consider caching if many windows are expected. 2. Memory Leak PotentialIf Mitigation: Add timeout cleanup in the LaunchedEffect that checks for pending tabs. ✅ Testing RecommendationsGiven the test plan in the PR description, I recommend adding:
📝 SummaryApprove with Changes: The core implementation is solid, but the race condition (#1) and null safety issue (#2) should be fixed before merging. The other issues are lower priority but worth addressing for production readiness. Priority Fixes:
Nice to Have:
Great work overall on a complex feature! 🎉 |
Scrollbar thumb and track colors now respect the settings values: - Thumb: 0xFFAAAAAA (grey) - Track: 0x40FFFFFF (subtle white) Previously these were hardcoded as white, ignoring user settings. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code Review - PR #102This PR implements tab transfer to new windows and context menu improvements. The implementation is well-structured, but there are several critical concerns that need to be addressed. 🔴 Critical Issues1. Thread Safety - Race Condition in Tab Transfer The WindowManager.pendingTabForNewWindow and pendingSplitStateForNewWindow are mutable object properties without synchronization. If multiple windows are created concurrently, the pending state could be overwritten before the first window reads it, read by multiple windows simultaneously, or left in an inconsistent state if window creation fails. Recommendation: Use AtomicReference or add synchronization to prevent state corruption. 2. Memory Leak Risk - Unchecked Pending Tab If createWindowWithTab() is called but the window creation fails or is cancelled, the pending tab remains in memory with an active PTY process consuming resources, no parent TabController managing it, and split state never disposed. Recommendation: Add try-catch and cleanup in the LaunchedEffect to dispose resources on failure.
|
Code Review: Tab Management and Context Menu ImprovementsThank you for this comprehensive PR! Implementation is well-structured and addresses multiple UX pain points. ✅ Strengths1. Excellent Tab Transfer Architecture
2. Clean State Management
3. Robust Context Menu Fix
4. UI Improvements
|
Scrollbar now only appears when user manually scrolls (mouse wheel or dragging scrollbar), not when programs output new lines. Changes: - Added userScrollTrigger parameter to AlwaysVisibleScrollbar - Track user-initiated scrolls separately from content updates - Scrollbar still shows on hover and drag (existing behavior) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code Review: Tab Management and Context Menu ImprovementsGreat work on this PR! The tab transfer feature is a solid UX improvement. Here's my detailed feedback: Strengths
CRITICAL: Race Condition in WindowManagerFile: Main.kt:79-83 The pendingTabForNewWindow static variables create a race condition. If user moves 2 tabs to new windows rapidly, the second call overwrites the first pending tab before it's consumed. Recommendation: Use a thread-safe queue (ConcurrentLinkedQueue) or pass the tab directly to TerminalWindow constructor. Other IssuesMissing Null Check (TabbedTerminal.kt:183): createTabFromExistingSession expects TerminalSession but gets TerminalTab. The cast could fail if type hierarchy changes. Context Menu Redundancy: New Tab appears in both tab menu and terminal menu. Consider removing from tab menu since there's already a + button. Scrollbar Thickness: Changed from 12dp to 10dp without explanation in PR description. Is this intentional? Testing Recommendations
Performance & Security
SummaryApprove with changes: Feature works well but needs race condition fix before merge. Priority fixes:
Optional improvements: Generated with Claude Code |
- Add bellTrigger state to ComposeTerminalDisplay for bell notifications - Change audibleBell default to true (was false) - Add visualBell setting to TerminalSettings (default: false) - Add bell handling in ProperTerminal with LaunchedEffect - Play system beep via java.awt.Toolkit when audibleBell enabled - Flash terminal with semi-transparent overlay when visualBell enabled 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Code Review: Tab Management and Context Menu ImprovementsThis is an excellent PR that delivers several user-facing improvements with clean implementation. Overall, the code quality is high and follows BossTerm conventions well. Strengths1. Tab Transfer Architecture (Outstanding)The extractTab() / createTabFromExistingSession() / WindowManager.pendingTabForNewWindow pattern is well-designed:
2. Context Menu Fix (Solid)The unfocused window handling at lines 114-127 of ContextMenuController.kt is a clever solution:
3. Scrollbar Improvements (Clean)The userScrollTrigger pattern effectively distinguishes user scrolls from content updates:
4. Auto-Scroll to Cursor (UX Win)The scroll-to-cursor behavior when typing while scrolled back is intuitive and matches standard terminal UX. Issues and SuggestionsHIGH PRIORITY: Potential Race Condition in Tab TransferLocation: Main.kt:79-82, TabbedTerminal.kt:173-191 Problem: Using mutable singleton state (WindowManager.pendingTabForNewWindow) for tab transfer creates a race condition. If user rapidly moves multiple tabs to new windows, both windows might claim the same pending tab, or a tab could be lost. Recommendation: Pass the tab directly to the window through constructor parameters instead of global state. Add initialTab and initialSplitState fields to TerminalWindow data class. MEDIUM PRIORITY: Bell Trigger State Not Scoped to TabLocation: ComposeTerminalDisplay.kt:95, ProperTerminal.kt:572-588 The bell trigger is in ComposeTerminalDisplay but accessed via display.bellTrigger. Since each tab has its own display, this should work correctly, but it is fragile. If tabs are reused or displays are pooled in the future, bells could trigger on wrong tabs. Recommendation: Move bell handling state to TerminalTab or ensure proper cleanup in ComposeTerminalDisplay.dispose(). LOW PRIORITY: Potential Exception in Context MenuLocation: ContextMenuController.kt:131 If the window is disposed/hidden between finding it and calling locationOnScreen, this could throw IllegalComponentStateException. Recommendation: Wrap in try-catch with fallback to screen location. LOW PRIORITY: Code DuplicationLocation: ProperTerminal.kt:790, 825 The showTerminalContextMenu and showHyperlinkContextMenu calls have nearly identical parameters (only url differs). Consider extracting to a helper function. Testing Recommendations
Security and Performance
Minor Nits
VerdictApprove with Recommendations This PR delivers valuable features with mostly solid implementation. The tab transfer race condition should be fixed before merge, but the workaround is straightforward. The other issues are minor and can be addressed in follow-up PRs if needed. Suggested Merge Strategy:
Great work overall! The code quality and attention to detail (especially the tab lifecycle management) are excellent. Reviewed by Claude Code |
- Rename 'Audio' section to 'Bell' in BehaviorSettingsSection - Add Visual Bell toggle with description 'Flash screen on ASCII bell' 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Code Review: Tab Management and Context Menu ImprovementsGreat work on this PR! The tab transfer feature and context menu improvements are well-implemented. Here's my detailed review: Strengths1. Tab Transfer Architecture
2. Context Menu Fixes
3. Cursor & Scrolling UX
4. Bell Feature
Potential IssuesCRITICAL: Race Condition in Tab TransferFile: Main.kt:62-64, TabbedTerminal.kt:177-188 Problem: Using mutable singleton state (WindowManager.pendingTabForNewWindow) creates a race condition when multiple windows are created concurrently. Impact:
Recommended Fix: Use a queue-based approach with ConcurrentLinkedQueue MEDIUM: Incomplete Menu Dismiss LogicFile: ContextMenuController.kt:122-125 Problem: Fallback case doesn't set popup.invoker, which prevents proper dismiss behavior. Impact: Menu may stay open when clicking elsewhere, requiring manual dismissal. Recommended Fix: Log a warning and avoid showing menu if no window found. MEDIUM: Visual Bell Timing Not ConfigurableFile: ProperTerminal.kt:583 Problem: Hardcoded 100ms flash duration may be too short/long for some users, especially those with visual impairments or photosensitivity. Recommended Fix: Add visualBellDurationMs setting. LOW: Resource Leak on Window CloseFile: TabController.kt:1093 Problem: If extracted tab is never added to another window, the tab's resources (PTY process, coroutines) are never disposed. Recommended Fix: Add timeout-based cleanup (30 seconds). Code Quality ObservationsGood Practices
Minor Suggestions
Testing Recommendations
Performance & SecurityPerformance: No regressions detected. All operations are O(1) or negligible overhead. Security: No issues found. No user input directly used in system calls. SummaryOverall Assessment: Approve with minor changes This is a solid PR that delivers on its promises. The tab transfer feature is architecturally sound, and the context menu fixes address real UX issues. Must Fix Before Merge:
Nice to Have: Estimated Risk: Medium (race condition in multi-window scenario) Great work on this feature! The implementation quality is high, and the architectural decisions show thoughtful design. Generated with Claude Code |
Code Review for PR #102 - Tab Management & Context Menu ImprovementsGreat work on this feature-rich PR! The tab transfer functionality and context menu fixes are valuable additions. Here's my detailed review: ✅ Strengths1. Tab Transfer Architecture
2. Context Menu RobustnessThe unfocused window fix in
3. Scrollbar Improvements
4. Bell System
🐛 Potential Bugs & IssuesCRITICAL: Race Condition in Tab TransferFile: Problem: Multiple windows could be created simultaneously. Both windows' Solution: Use MODERATE: Missing Null Safety in extractTabFile: Problem: If another thread/coroutine modifies Solution: Use synchronized block or mutex around the entire method body. MINOR: Memory Leak Risk in AWT IntegrationFile: Problem: While not a direct leak, repeatedly calling Solution: Consider adding a comment explaining the focus request is necessary for proper popup dismissal. ⚡ Performance Considerations1. Scrollbar userScrollTrigger OverheadFile: Impact: Smooth scrolling generates 60+ events/sec, causing 60 recompositions/sec of the scrollbar. Mitigation: This is acceptable because 2. Visual Bell OverlayThe 🔒 Security ConcernsLOW: No Validation of Tab TransferFile: Scenario: If a disposed or corrupted tab is passed, the new window could crash or exhibit undefined behavior. Mitigation: Add defensive check with 🧪 Test Coverage RecommendationsUnit Tests
Integration Tests
📝 Code Quality Suggestions1. Add KDoc for extractTabDocument that the extracted tab remains alive and the caller MUST add it to another TabController or manually dispose it. 2. Consistent NamingThe codebase mixes 3. Settings Defaults DocumentationAdd a migration note about the 🎯 Priority Action Items
✨ Overall AssessmentScore: 8.5/10 This PR delivers valuable features with solid implementation quality. The tab transfer mechanism is architecturally sound, and the context menu fixes address real UX pain points. The critical race condition is the only blocker preventing immediate merge. Recommendation: Fix the thread-safety issue, then merge. The other suggestions are improvements for future consideration. Great work! 🚀 |
Add support for OSC 1337;SetProgress (iTerm2) and OSC 9;4 (Windows Terminal) progress bar sequences. Changes: - Add ProgressState enum to TerminalDisplay (HIDDEN, NORMAL, ERROR, INDETERMINATE, WARNING) - Add setProgress() method to Terminal and TerminalDisplay interfaces - Parse OSC 1337;SetProgress in BossEmulator1 (iTerm2 format) - Parse OSC 9;4 in BossEmulator1 (Windows Terminal/ConEmu format) - Add progressState and progressValue state to ComposeTerminalDisplay - Display progress indicator at bottom of tab items in TabBar - Color coding: blue (normal), red (error), yellow (warning) Test with: printf '\033]1337;SetProgress=50\007' # 50% progress printf '\033]1337;SetProgress=end\007' # hide progress printf '\033]9;4;1;75\007' # Windows Terminal style 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
PR Review: Tab Management and Context Menu ImprovementsThis is an excellent PR with well-implemented features! The code quality is high, and the architectural decisions are sound. ✅ Strengths1. Progress Bar Implementation (OSC 9;4 & OSC 1337)
2. Tab Transfer Architecture
3. Context Menu Fixes
4. Scrollbar Improvements
5. Bell Enhancements
|
Progress bar is now displayed at the top of the terminal content area instead of in the tab bar. This ensures visibility even when tab bar is hidden (single tab mode). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Pull Request ReviewThis PR introduces several valuable features and improvements to BossTerm. Here's my detailed review: ✅ Strengths1. Tab Transfer ArchitectureThe tab transfer to new window feature is well-architected:
2. Context Menu ImprovementsThe fix for stuck context menus is robust:
3. Scrollbar BehaviorThe
4. Progress Bar and Bell FeaturesWell-implemented iTerm2/Windows Terminal compatibility:
|
| Priority | Issue | Action |
|---|---|---|
| CRITICAL | Tab transfer race condition | Use Channel or synchronization |
| MEDIUM | Progress bar testing | Add test script with OSC sequences |
| MEDIUM | Context menu coordinates | Document parameter expectations |
| MEDIUM | Bell counter overflow | Use modulo or unsigned int |
| MINOR | TabBar context menu position | Pass actual coordinates or document |
Approval Status
Conditional Approval: This PR is well-crafted overall, but I recommend addressing the critical race condition before merging to master. The other issues are minor and can be addressed in follow-up PRs if time is limited.
Estimated Risk: Medium (race condition is low probability but high impact)
Great work on the tab transfer feature! The architecture is solid, just needs thread-safety hardening.
Indeterminate progress now shows a smooth floating gradient animation instead of a static full-width bar. The gradient sweeps across the bar every 1.5 seconds for a polished loading indicator effect. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Pull Request Review: Tab Management and Context Menu ImprovementsSummaryThis PR implements several important UX improvements including tab transfer between windows, context menu fixes, cursor/scrolling behavior improvements, and progress bar support. Overall, the implementation is solid with good attention to detail. Positive Highlights1. Tab Transfer Architecture ✅The
Location: 2. Progress Bar Support ✅Excellent support for multiple terminal progress protocols:
Locations: 3. Context Menu Focus Handling ✅Smart fix for unfocused window menus:
Location: 4. Scrollbar Improvements ✅
Issues & Recommendations🔴 Critical: Resource Leak in Window TransferLocation: if (pendingTab != null) {
WindowManager.pendingTabForNewWindow = null
WindowManager.pendingSplitStateForNewWindow = null
tabController.createTabFromExistingSession(pendingTab)
// ...
}Issue: If Recommendation: if (pendingTab != null) {
try {
tabController.createTabFromExistingSession(pendingTab)
if (pendingSplitState != null) {
splitStates[pendingTab.id] = pendingSplitState
}
} finally {
// Clear after successful transfer
WindowManager.pendingTabForNewWindow = null
WindowManager.pendingSplitStateForNewWindow = null
}
}🟡 Medium: Race Condition in extractTab()Location: if (tabs.isEmpty()) {
notifyAllSessionsClosed()
onLastTabClosed() // Creates new window via WindowManager
}Issue: If tab extraction is the last tab, Recommendation: Add ordering guarantees or defensive checks: if (tabs.isEmpty()) {
notifyAllSessionsClosed()
// Defer window creation slightly to allow pending state to settle
coroutineScope.launch {
delay(10) // Small delay
onLastTabClosed()
}
}🟡 Medium: Missing Validation in Progress HandlersLocations: Issue: Progress values are coerced but state transitions aren't validated. For example, transitioning from ERROR to NORMAL might have semantic meaning for the UI. Recommendation: Consider adding validation: // Validate state transitions
if (currentState == ProgressState.ERROR && state == ProgressState.NORMAL) {
// Log or handle semantic transition
}🟢 Minor: Inconsistent Error HandlingObservation:
Recommendation: Consistent logging strategy - either both log or both silent. Given these are terminal sequences, logging is preferred for debugging. 🟢 Minor: Magic NumbersLocation: LaunchedEffect(userScrollTrigger.value) {
if (userScrollTrigger.value > 0) { // Magic numberRecommendation: Use named constant: private const val INITIAL_SCROLL_TRIGGER = 0
// ...
if (userScrollTrigger.value > INITIAL_SCROLL_TRIGGER) {🟢 Minor: Hardcoded Window Finding LogicLocation: .maxByOrNull { it.bounds.width * it.bounds.height } // Prefer larger windowIssue: If windows are stacked, this picks the largest rather than the topmost. Recommendation: Consider z-order: .sortedByDescending { (it as? java.awt.Frame)?.state ?: Int.MIN_VALUE }
.firstOrNull { it.isVisible && it.bounds.contains(mousePoint) }Security Considerations✅ No SQL Injection RiskNo database queries present. ✅ No XSS RiskProgress bar values are integers/enums, not rendered as HTML. ✅ No Command InjectionTerminal sequences are parsed, not executed as shell commands.
|
OSC parser splits on semicolons, so 'SetProgress=error;30' was being split into separate args. Now reconstructs the full value by joining all args after SetProgress=. Fixes: error, warning, indeterminate states with progress values 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Gradient now animates from off-screen left to off-screen right - Uses Canvas for proper gradient positioning - Wider gradient (35% of bar width) for smoother appearance - Animation duration reduced to 1.2s for better feel - No visible jump at loop restart 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Code Review - PR #102: Tab Management and Context Menu ImprovementsThis is a well-structured PR with multiple useful features. Code quality is generally good, but several areas need improvement. 🎯 Overall AssessmentStrengths:
Areas for Improvement:
🐛 Critical Issues1. Tab Extraction Race Condition (TabController.kt:1093-1118)Issue: Problem: When a tab is extracted and the source window closes, background coroutines may become orphaned, causing memory leaks and race conditions. Fix: Add explicit pause/resume: fun extractTab(index: Int): TerminalTab? {
val tab = tabs[index]
tab.isActive = false // Pause before transfer
tabs.removeAt(index)
return tab
}
fun createTabFromExistingSession(session: TerminalSession): Int {
val tab = session as TerminalTab
tab.isActive = true // Resume in new context
// ...
}2. Context Menu Window Focus (ContextMenuController.kt:111-128)Problem: Using Fix: Use first matching window (AWT returns front-to-back): targetWindow = Window.getWindows()
.firstOrNull { it.isVisible && it.bounds.contains(mousePoint) }3. Progress Bar Animation Memory Leak (ProperTerminal.kt:1520-1527)Problem: Fix: Move animation inside conditional: val animatedOffset = if (progressState == ProgressState.INDETERMINATE) {
rememberInfiniteTransition().animateFloat(...)
} else {
remember { mutableStateOf(0f) }
}4. WindowManager Race Condition (Main.kt:58-82)Problem: Concurrent window creation could race on Fix: Atomic swap pattern: @Synchronized
fun takePendingTab(): Pair<TerminalTab?, SplitViewState?> {
val result = pendingTabForNewWindow to pendingSplitStateForNewWindow
pendingTabForNewWindow = null
pendingSplitStateForNewWindow = null
return result
}
|
Pull Request Review - PR #102This is a substantial PR that adds important UX improvements. Overall quality is high, but several critical issues need attention. Critical Issues1. Thread Safety in WindowManagerFiles: Main.kt lines 61-62 The mutable var properties create race conditions:
2. Tab Extraction Memory LeakFile: TabController.kt:610-627 extractTab() removes tab but doesn't call notifySessionClosed. If transfer fails:
3. Progress Bar Input ValidationFile: BossEmulator1.kt:439 Missing bounds check: val progress = args.getIntAt(3, -1) should use .coerceIn(-1, 100) 4. OSC Parser DoS RiskFile: BossEmulator1.kt:451-520 Unlimited args reconstruction in iTerm2 parser. Add max limit (e.g., 20 args) to prevent memory exhaustion from malicious sequences. Code Quality Issues5. Context Menu Focus LogicFile: ContextMenuController.kt:117-128 6. Inconsistent OSC Error LoggingFile: BossEmulator1.kt 7. Scrollbar Trigger ThrashingFile: AlwaysVisibleScrollbar.kt:97-101 Documentation Issues8. Breaking Changes Not Documented
9. Missing OSC Protocol DocsNew OSC 1337 and OSC 9;4 support should be documented in README or CLAUDE.md Positive Highlights
Testing GapsMissing tests for:
Verdict: Request ChangesMust fix before merge:
Should fix: Consider for future: Once critical issues addressed, this will be a great addition! Reviewed by: Claude Code (Sonnet 4.5) |
- Add progressBarEnabled setting (default: true) - Add progressBarPosition setting (top/bottom, default: bottom) - Add progressBarHeight setting (1-10 dp, default: 6dp) - Add Progress Bar section to Behavior settings UI - Slower animation (2500ms) for smoother indeterminate state 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Code Review for PR #102: Tab Management and Context Menu ImprovementsOverall AssessmentThis is a well-structured PR with solid implementation of several important features. The code quality is generally high with good attention to resource management and user experience. Strengths1. Excellent Resource Management
2. Good UX Improvements
3. Progress Bar Implementation
Code Quality Issues1. Critical: Race Condition in Window TransferLocation: Main.kt:61-63, TabbedTerminal.kt:173-192 The global mutable state pattern is not thread-safe. If two tabs are moved to new windows rapidly, the second operation could overwrite the first pending state. Recommendation: Use thread-safe queue or atomic reference like ConcurrentLinkedQueue 2. Type Safety IssueLocation: TabController.kt:1220-1221 Unsafe cast without validation. Use safe cast with validation or elvis operator. 3. Missing Bounds ValidationLocation: BossEmulator1.kt:452 Progress value not validated before passing to setProgress(). Add coerceIn(-1, 100) at parse time. 4. Inconsistent Error HandlingLocation: BossEmulator1.kt:490-496 iTerm2 parser silently returns false without logging. Add debug logging for parse failures. Potential Bugs1. Cursor Position Calculation IssueLocation: ProperTerminal.kt:1275-1278 Auto-scroll unconditionally scrolls to scrollOffset = 0, but cursor might be in middle of visible area if using alternate screen buffer (vim, less). Check if cursor is actually out of view before scrolling. 2. Missing Null Check in Context MenuLocation: TabbedTerminal.kt:224-226 Between getOrNull() and extractTab(), another thread could remove the tab. Extract tab first, then remove split state. Security ConsiderationsOSC Sequence Injection (Low Risk)Location: BossEmulator1.kt:470-496 iTerm2 parser joins arbitrary arguments without sanitization. Consider adding length limits (e.g., 100 chars). PerformanceRedundant State UpdatesLocation: ComposeTerminalDisplay.kt:156-165 setProgress() always updates state even if values unchanged. Add conditional updates to avoid unnecessary recompositions. Summary
Recommendations for MergeMust Fix Before Merge:
Should Fix: Nice to Have: Great work overall! The features are well-designed and follow BossTerm architectural patterns. Issues identified are mostly edge cases that should be addressed for production robustness. |
- Add TerminalClipboardListener interface for clipboard operations - Parse OSC 52 sequences in BossEmulator1.kt (query, set, clear) - Implement clipboard processing in BossTerminal.kt with base64 encoding - Create ClipboardHandler for Compose layer with AWT clipboard access - Add security settings: clipboardOsc52Enabled, AllowRead, AllowWrite - AllowRead disabled by default (security), AllowWrite enabled (safe) - Add clipboard settings UI in Behavior settings section Test with: printf '\033]52;c;SGVsbG8gV29ybGQ=\007' # Set clipboard to "Hello World" printf '\033]52;c;?\007' # Query clipboard (if enabled) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Pull Request Review: Tab Management and Context Menu ImprovementsThis is a solid PR that implements several user-facing improvements. What's Working Well1. Tab Transfer Architecture (Excellent)The extractTab() implementation is well-designed:
File: TabController.kt:1106-1131 2. Split Layout PreservationThe entire split state transfer is elegantly handled:
Files: TabbedTerminal.kt:174-188, 222-232 3. Context Menu Focus FixThe unfocused window fix is well-thought-out:
File: ContextMenuController.kt:114-136 4. OSC 52 Security ModelThe clipboard handler implements proper security controls:
Issues & Concerns1. CRITICAL: OSC 52 Base64 Decoding VulnerabilityLocation: BossTerminal.kt:429-434 Problem: This silently catches IllegalArgumentException but doesn't validate the decoded string. A malicious or malformed terminal sequence could potentially:
Recommendation: Add explicit UTF-8 charset and size limit check (suggest MAX_CLIPBOARD_SIZE = 10MB). 2. Code Quality: Scrollbar Default InconsistencyLocation: AlwaysVisibleScrollbar.kt:65 and TerminalSettings.kt:469 Issue: Default scrollbar thickness is 10dp in one place but 8dp in settings. Which is correct? 3. OSC 9;4 State Validation MissingLocation: BossEmulator1.kt:457-471 Issue: Progress value is not validated (could be negative or > 100). This IS validated in parseITerm2Progress() at line 562, but NOT in processOsc9Progress(). Inconsistent. 4. Settings DocumentationNew settings added but not documented in CLAUDE.md:
5. Race Condition RiskLocation: WindowManager singleton state pendingTabForNewWindow and pendingSplitStateForNewWindow are global mutable state. If user rapidly clicks Move to New Window multiple times, could corrupt state. Recommend using AtomicReference or clearing state immediately after read. Testing RecommendationsCritical Test Cases:
SummaryOverall Assessment: 4/5 stars This is a well-structured PR that implements genuinely useful features. The tab transfer mechanism is elegant and the context menu fixes are solid. Must Fix Before Merge:
Should Fix: Recommendation: Request changes for security fix, then approve after addressed. Great work overall! The feature implementation is solid and code quality is high. Just needs a few security/robustness tweaks. |
Add comprehensive support for dynamic terminal color management: - OSC 4: Set/query ANSI palette colors (0-255) - OSC 10/11: Enhanced to support setting foreground/background (was query-only) - OSC 104: Reset indexed palette colors (single or all) - OSC 110-112: Reset foreground, background, cursor colors to defaults Added TerminalColorChangeListener interface for Compose layer integration. Color parsing supports hex (#RGB, #RRGGBB), rgb:RR/GG/BB, and X11 formats. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Code Review for PR #102I've reviewed this pull request and have the following feedback: ✅ Overall AssessmentThis is a well-implemented PR with several valuable features. The code quality is high, follows good practices, and the implementation is thoughtful. A few minor concerns exist around security, thread safety, and error handling. Detailed Findings🔒 Security1. OSC 52 Clipboard Security ✅ GOODLocation:
// Suggested addition around line 23:
private const val MAX_CLIPBOARD_SIZE = 10 * 1024 * 1024 // 10MB limit
override fun onClipboardSet(selection: Char, content: String) {
if (!settings.clipboardOsc52Enabled || !settings.clipboardOsc52AllowWrite) {
LOG.debug("OSC 52 clipboard write blocked by settings")
return
}
if (content.length > MAX_CLIPBOARD_SIZE) {
LOG.warn("OSC 52 clipboard content exceeds size limit")
return
}
// ... rest of method
}2. OSC Color Sequences - Missing Validation
|
Pull Request Review: Tab Management and Context Menu ImprovementsOverviewThis PR introduces significant improvements to tab management, context menus, cursor behavior, and adds support for several OSC sequences. Changes: 1,084 additions, 41 deletions across 15 files. Strengths1. Tab Transfer Architecture - Well-designed with clean separation via WindowManager.pendingTabForNewWindow, preserves complete terminal state 2. Security-First Clipboard (OSC 52) - Settings-based controls, proper base64 encoding/decoding with exception handling 3. Comprehensive OSC Support - OSC 52 (clipboard), OSC 4 (palette colors), OSC 10-12 (dynamic colors), OSC 104/110-112 (resets), OSC 9;4 and OSC 1337 (progress bars) 4. Robust Error Handling - Try-catch blocks, validation, debug logging throughout Critical Issues1. Memory Leak - Missing Cleanup (HIGH PRIORITY) Location: TabController.kt:212-214, BossTerminal.kt:84-89 Problem: ClipboardHandler and CommandNotificationHandler are added but never removed when tabs close. This causes memory leaks and potential crashes. Fix Required: Add listener cleanup in TerminalTab disposal:
2. Incomplete Color Query Implementation Location: BossTerminal.kt:505-512 Problem: getIndexedColor returns null (marked incomplete) but is called by processIndexedColor for OSC 4 queries. Fix Options: Store colors in BossTerminal, add query method to listener interface, or remove query support. 3. Thread Safety - Single Listener Assumption Location: BossTerminal.kt:414-421 Problem: onClipboardGet assumes only one listener exists but multiple could be registered. Fix: Document expectation or add assertion. RecommendationsMust Fix (Blocking):
Should Fix (High Priority): Overall AssessmentWell-architected PR with comprehensive OSC support and clean tab transfer mechanism. However, memory leak risk from unremoved listeners must be addressed before merge. Recommended Action: Request changes for listener cleanup, approve after verification. Review by: Claude Code |
Tab management and context menu improvements
Summary
Tab Management
Context Menu Fixes
Cursor & Scrolling
Scrollbar Improvements
Test plan
lsmultiple times → verify scrollbar doesn't appear🤖 Generated with Claude Code