Skip to content

fix(monitor): correct formatIssueShort overhead calculation#53

Merged
marcus merged 2 commits intomainfrom
shrike/fix-issue-short-overhead
Mar 1, 2026
Merged

fix(monitor): correct formatIssueShort overhead calculation#53
marcus merged 2 commits intomainfrom
shrike/fix-issue-short-overhead

Conversation

@marcus
Copy link
Owner

@marcus marcus commented Mar 1, 2026

Problem

The formatIssueShort function calculates available title width using an overhead that overestimates by 3 chars.

Error 1: 8 was meant for the row prefix " [TAG] " (8 chars), but the actual format is "%s %s"(tag, issueStr) where tag=[RDY] = 5 chars + 1 space = 6 chars.

Error 2: Type icon hardcoded as 2 but all icons (■●◆✗○) are 1 visual char.

Fix

overhead := 4 + 5 + 1 + lipgloss.Width(typeIcon) + lipgloss.Width(idStr) + lipgloss.Width(priorityStr) + 3

Gives task titles 3 more display characters before truncation.

Impact

  • Fixes premature title truncation in both td monitor and sidecar's embedded td view (sidecar#215)
  • Icon width now uses lipgloss.Width() for terminal accuracy

Tests pass: go test ./pkg/monitor/...

- scripts/pre-commit.sh: checks gofmt on staged .go files, go vet, go build
- make install-hooks: symlinks hook into .git/hooks/pre-commit
- README: document make install-hooks in dev section

Same pattern as nightshift and sidecar.
The overhead for title width calculation in formatIssueShort was
overestimating by 3 chars:

- Tag was counted as 8 ('  [TAG] ' with phantom 2 leading spaces)
  but actual category tags are 5 chars plus 1 space = 6 chars
- Type icon was hardcoded as 2 chars wide but all type icons
  are 1 visual char; the space-after-icon was already in the
  3-spaces count

Correct formula: 4(panel) + 5(tag) + 1(space) + typeIconWidth +
idWidth + priWidth + 3(format spaces)

This gives task titles 3 more characters of display space, reducing
premature truncation in both td monitor and sidecar embedded mode.

Fixes: title truncation visible in sidecar td view vs standalone
td monitor (github.com/marcus/sidecar/issues/215)
@marcus marcus merged commit c4882eb into main Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant