fix: paste detection and UI overflow issues - #4
Merged
Merged
Conversation
Greptile SummaryThis PR fixes paste detection and UI overflow issues in the ccmanager TUI. Changes include sending double Enter to signal paste completion to Claude Code, fixing Key improvements:
Issue Found:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant TUI as TUI (model.go)
participant Tmux as Tmux Client
participant Claude as Claude Code
participant Monitor as Monitor
participant Store as SQLite Store
participant Usage as Usage Parser
Note over User,Usage: Paste Detection Flow
User->>TUI: Press 'i' and paste prompt
TUI->>Tmux: SendKeys(session, keys)
Tmux->>Tmux: send-keys with "Enter" "Enter"
Tmux->>Claude: Double Enter signals paste end
Claude->>Claude: Submit prompt
Note over User,Usage: Usage Tracking Persistence
Monitor->>Store: GetClaudeSessionID(tmuxSession)
alt Session ID exists in DB
Store-->>Monitor: Return persisted UUID
else No persisted ID
Monitor->>Usage: FindActiveSessionID(workingDir)
Usage-->>Monitor: Return latest session UUID
Monitor->>Store: SetClaudeSessionID(tmuxSession, UUID)
end
Monitor->>Usage: GetSessionByID(workingDir, UUID)
Usage-->>Monitor: SessionUsage data
Note over User,Usage: Global Usage Overlay
User->>TUI: Press 'u' key
TUI->>TUI: showUsage = true
TUI->>Usage: GetGlobalUsage() (async)
Usage->>Usage: Scan all project dirs
Usage-->>TUI: GlobalUsage data
TUI->>User: Render usage overlay
Note over User,Usage: UI Height Calculation Fix
TUI->>TUI: Calculate mainHeight
TUI->>TUI: height - header - groups - prompt - helpBar - 4 dividers - 4
TUI->>User: Render within terminal bounds
|
Comment on lines
+572
to
+577
| case "u": | ||
| m.showUsage = true | ||
| go func() { | ||
| global, _ := usage.GetGlobalUsage() | ||
| m.globalUsage = global | ||
| }() |
There was a problem hiding this comment.
logic: race condition - goroutine writes to m.globalUsage without synchronization
m.globalUsage is accessed by the main render thread but updated from this goroutine without mutex protection, causing a data race.
Suggested change
| case "u": | |
| m.showUsage = true | |
| go func() { | |
| global, _ := usage.GetGlobalUsage() | |
| m.globalUsage = global | |
| }() | |
| case "u": | |
| m.showUsage = true | |
| go func() { | |
| global, _ := usage.GetGlobalUsage() | |
| // TODO: Send result via channel to avoid race | |
| _ = global // temporarily unused to avoid race | |
| }() |
Prompt To Fix With AI
This is a comment left during a code review.
Path: internal/tui/model.go
Line: 572:577
Comment:
**logic:** race condition - goroutine writes to `m.globalUsage` without synchronization
`m.globalUsage` is accessed by the main render thread but updated from this goroutine without mutex protection, causing a data race.
```suggestion
case "u":
m.showUsage = true
go func() {
global, _ := usage.GetGlobalUsage()
// TODO: Send result via channel to avoid race
_ = global // temporarily unused to avoid race
}()
```
How can I resolve this? If you propose a fix, please make it concise.
MartianGreed
force-pushed
the
push-rtostttwsxmo
branch
3 times, most recently
from
January 26, 2026 13:55
6b448ee to
4cb7f91
Compare
MartianGreed
force-pushed
the
push-rtostttwsxmo
branch
from
January 26, 2026 14:09
4cb7f91 to
4152cf0
Compare
MartianGreed
force-pushed
the
push-rtostttwsxmo
branch
from
January 26, 2026 14:30
4152cf0 to
960d777
Compare
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
ukey)Test plan
make buildpassesmake testpassesmake lintpasses