Skip to content

Schedule command fixes#215

Merged
narthur merged 12 commits intomainfrom
schedule-fixes
Jan 26, 2026
Merged

Schedule command fixes#215
narthur merged 12 commits intomainfrom
schedule-fixes

Conversation

@narthur
Copy link
Collaborator

@narthur narthur commented Jan 26, 2026

Summary by CodeRabbit

  • New Features

    • Colorized timeline rendering when terminal supports color
    • Automatic wrapping of long goal lists with continuation markers based on terminal width
    • Dynamic terminal-width detection for display layout
  • Improvements

    • Hourly density chart expanded to full 24-hour labeling with clearer axis and markers
    • Wider count area with overflow indicator for large counts and de-emphasized empty hours
    • Improved alignment, spacing and color-aware rendering for timeline and density displays

✏️ Tip: You can customize this high-level summary in your review settings.

Update the ASCII hourly chart to use a consistent 3-character width
per hour (two bar characters + one space), increasing the chart line
from 24 to 72 positions plus a 4-character left prefix. This change
improves horizontal spacing so each hour has a wider visual column and
labels align more clearly.

- Render each hour's bar as a 2-character wide block (write the same
  bar rune twice) followed by a space to create uniform columns.
- Expand label, axis, and count buffers from 28 to 76 runes to match
  the new 3-char-per-hour layout; compute positions as 4 + hour*3.
- Show labels for all 24 hours (00–23) instead of a sparse selection.
- Draw axis markers for every hour and fill horizontal segments
  between the first and last marker.
- Change count label formatting: use " ∞" for counts >99 and right-align
  counts in a 2-character field to prevent truncation and keep columns aligned.
- Simplify bar selection by assigning the computed rune to a variable
  before writing, and ensure nonzero counts map to at least one bar level.

These adjustments make the chart easier to read and keep hour-aligned
elements consistent across the rendered lines.
…nicode codepoint escape for the infinity symbol to ensure

consistent encoding across environments Change number formatting
from right-aligned to left-aligned in the 2-character badge field
so small counts render more predictably within the fixed-width slot.

This improves visual consistency of count badges and avoids encodingissues with literal symbols source files.
When rendering the hour axis, use a downward-only tick (┴) for hours
that have zero counts and a full cross (┼) for hours with counts.
This makes the axis visually reflect whether an hour extends down
(from counts) or only up, improving clarity of the chart.
Use a strings.Builder to construct the hour label line and apply
ANSI gray color to hours that have zero counts. This replaces the
previous fixed-width rune buffer approach and simplifies label
assembly while visually de-emphasizing inactive hours. Keep spacing
and output layout unchanged.
Improve timeline printing by wrapping long goal lists to fit the
terminal width and indenting wrapped lines for readability.

- Preserve original "HH:MM ├─ " prefix and compute its visual width.
- Read COLUMNS env var (fallback to 80) to determine available width.
- Split goals on commas and assemble lines so they don't exceed width,
  printing a new indented continuation line when needed.
- Use a vertical continuation marker and consistent indentation to
  align wrapped content with the goals column.
- Add fallbacks and minimal safety width to avoid pathological layouts.

This prevents overflowing long goal lists and improves clarity on narrow
terminals.
Refactor goal-wrapping logic to correctly split and wrap long
comma-separated goal lists across multiple output lines.

- Move goals splitting and line builder setup out of inner loop for
  clearer control flow.
- Iterate over goals without relying on index; compute separator
  based on current line content.
- When a goal does not fit, print current line, start a new wrapped
  line prefixed with a vertical continuation marker, and write the
  overflowing goal to the new line.
- Ensure a trailing comma is added when wrapping to indicate there
  are more goals on the next line.

These changes fix incorrect separator handling and ensure wrapped
lines maintain readable indentation and punctuation.
Add ANSI color sequences to the timeline printer to improve visual
clarity. Time labels now appear in cyan and the tree/continuation
characters (├─ and │) appear in gray. Wrapped continuation lines
also include the colored vertical separator so wrapped text keeps the
same visual structure.

This change updates prefix construction and the continuation-line
indent so widths remain correct while inserting color escape codes.
Update hour label and timeline rendering to avoid emitting ANSI
color sequences when colors are disabled. Detect the terminal color
profile and only apply gray/cyan/reset escape codes if a non-ASCII
color profile is in use.

Key changes:
- Add colorProfile detection before building hour labels and skip
  dimming (gray) when colors are disabled.
- Guard time/tree/reset color variables for timeline output behind
  the same colorProfile check to prevent bare escape codes when
  --no-color is used.

This prevents visible raw ANSI sequences from appearing in
environments where colors are turned off and keeps visual dimming
when colors are available.
Copilot AI review requested due to automatic review settings January 26, 2026 15:38
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 26, 2026

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

displayHourlyDensity was rewritten to render a 24-hour, two-character-per-hour bar chart with expanded count/axis areas and computed first/last markers; displayTimeline now detects color support and wraps long goal lists to terminal width (COLUMNS) with comma-aware multi-line breaks and colored continuation prefixes; handleScheduleCommand uses these renderers.

Changes

Cohort / File(s) Summary
Hourly density rendering
main.go
Reworks displayHourlyDensity to draw 24 hours with 2-character-wide bars (duplicated bar glyphs) and trailing spaces; expands the count-label area to ~76 chars and left-aligns 2-char count fields, showing for >99; computes first/last marker positions and renders axis with / markers and extended segments; zero-count hours are de-emphasized when color is enabled.
Timeline rendering & wrapping
main.go
Reimplements displayTimeline to detect terminal color support and conditionally apply color codes; reads COLUMNS for terminal width and wraps long goal lists across lines by breaking at comma boundaries; inserts a colored continuation prefix including a vertical bar for wrapped lines and preserves alignment and coloring for wrapped segments.
Command integration & flow
main.go
Updates handleScheduleCommand to use the new color-aware, width-aware displayHourlyDensity and displayTimeline behavior and wrapping strategy; formatting, axis/layout and timeline output paths adjusted accordingly.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Schedule command fixes' is vague and generic, using non-specific language that doesn't convey the actual changes (24-hour chart display, color-aware rendering, terminal width detection, and line wrapping). Use a more specific title that describes the primary change, such as 'Add 24-hour density chart visualization and color-aware terminal wrapping to schedule command' or similar.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@narthur narthur changed the title schedule-fixes Schedule command fixes Jan 26, 2026
@github-actions
Copy link

github-actions bot commented Jan 26, 2026

🚀 Pre-release Build Ready

Test builds are ready! Install directly using the bin command:

# Install the pre-release
bin install https://github.com/PinePeakDigital/buzz/releases/tag/pr-215-latest buzz-pr-215
# Run the pre-release
buzz-pr-215
# Uninstall the pre-release
bin remove buzz-pr-215

Direct Download Links

Or download binaries directly from the pre-release page:

💡 No GitHub login required for downloads!

🗑️ This pre-release will be automatically deleted when the PR is closed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refines the schedule visualization output, improving the hourly density chart and the textual timeline display for goal deadlines.

Changes:

  • Adjusts displayHourlyDensity to use fixed-width bars and labels for all 24 hours, adds colored de-emphasis for empty hours, and aligns axis/count labels to the new layout.
  • Enhances displayTimeline with optional color for time and tree glyphs, and adds width-aware wrapping of goal lists based on the COLUMNS environment variable.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@main.go`:
- Around line 1310-1325: The label-building loop uses raw ANSI escapes to dim
zero-count hours; replace that with lipgloss styling for consistency by creating
a dim style (e.g., via lipgloss.NewStyle().Foreground(lipgloss.Color(...)) or
.Foreground(lipgloss.AdaptiveColor(...)) and using it when hourCounts[hour]==0
and colorProfile!=termenv.Ascii; update the code around lipgloss.ColorProfile(),
termenv.Ascii, and labelLine so you call style.Render(label) instead of
concatenating "\033[90m" and "\033[0m", preserving the same spacing and
formatting.
- Around line 1413-1431: The prefix visual width is being measured with
len([]rune(prefix)) which counts ANSI color escape sequences; update the
calculation in main.go (the block that builds prefix and computes
prefixWidth/available) to strip ANSI escape sequences from prefix before
counting runes (e.g., remove patterns like ESC [ ... m) so prefixWidth reflects
visible characters only, then use len([]rune(cleanPrefix)) for width math;
ensure the logic still falls back to minimal safety width when cleaned
prefixWidth >= available.

Use a lipgloss style for dimming hour labels instead of raw
ANSI escape codes. This centralizes styling through the color
profile and avoids embedding raw control sequences in strings.

Replace the dynamic rune-based prefix width calculation with a
constant visual width for the formatted time/tree prefix. ANSI
escape sequences are zero-width, so using a fixed visual width
(9) simplifies wrapping math and prevents incorrect available
width computation when prefixes contain color codes.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@main.go`:
- Around line 1397-1406: The timeline color variables currently use raw ANSI
codes; replace them with lipgloss styles for consistency: create lipgloss styles
(e.g., timeStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("36")) and
treeStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("90"))) in place of
timeColor/treeColor/resetColor, and update any timeline rendering to call
timeStyle.Render(timeStr) and treeStyle.Render("├─"/"│") instead of
concatenating ANSI strings; ensure any checks against termenv.Ascii remain to
disable styling when appropriate (same logic used around displayHourlyDensity).

narthur and others added 2 commits January 26, 2026 10:56
Use lipgloss styles instead of embedding raw ANSI escape codes
for timeline elements. Replace string color variables with lipgloss
Style objects (timeStyle, treeStyle) and render colors via
lipgloss.Render so styling integrates with lipgloss/termenv color
detection and respects the --no-color/ASCII fallback.

Update prefix and continuation line construction to use the new
styles (timeStyle.Render and treeStyle.Render) instead of manual
escape sequences, and simplify color handling logic. This makes
the code clearer, safer (avoids manual ANSI), and consistent with
the project's styling library.
@narthur narthur merged commit 3f043f7 into main Jan 26, 2026
2 checks passed
@narthur narthur deleted the schedule-fixes branch January 26, 2026 17:01
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.

2 participants