Skip to content

Fix ANSI color overflow in split-pane layout#7

Closed
Copilot wants to merge 5 commits intoclaude-code-implementationfrom
copilot/sub-pr-1
Closed

Fix ANSI color overflow in split-pane layout#7
Copilot wants to merge 5 commits intoclaude-code-implementationfrom
copilot/sub-pr-1

Conversation

Copy link
Copy Markdown

Copilot AI commented Jan 22, 2026

ANSI color codes from the detail panel were bleeding into the issue list because string truncation used len(), which counts escape sequences as characters rather than visual width.

Changes

  • Import github.com/charmbracelet/x/ansi for visual width calculations
  • Add padLineWithANSI() helper that uses ansi.StringWidth() and ansi.Truncate() for proper truncation/padding with ANSI awareness
  • Update renderDetailPanel() to pad each line to exact visual width
  • Update renderListPanel() to pad styled lines consistently

Technical Details

The issue occurs when combining lipgloss-styled text (which adds ANSI codes) with naive string truncation:

// Before: Incorrect - len() counts ANSI escape sequences
if len(line) > width {
    scrolledLines[i] = line[:width]  // May truncate mid-escape-sequence
}

// After: Correct - visual width calculation
func padLineWithANSI(s string, width int) string {
    visualWidth := ansi.StringWidth(s)
    if visualWidth >= width {
        return ansi.Truncate(s, width, "")
    }
    return s + strings.Repeat(" ", width-visualWidth)
}

This ensures panels maintain exact boundaries and handles Unicode properly (CJK characters, emojis, combining characters).


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits January 22, 2026 01:28
Co-authored-by: ShepAlderson <1037047+ShepAlderson@users.noreply.github.com>
Co-authored-by: ShepAlderson <1037047+ShepAlderson@users.noreply.github.com>
Co-authored-by: ShepAlderson <1037047+ShepAlderson@users.noreply.github.com>
Co-authored-by: ShepAlderson <1037047+ShepAlderson@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Jan 22, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /update-job-proxy /update-job-proxy tier/go-toml/v2/ls-files mpile 0.1-go1.25.5.lin--others -o 4y8mbtKyl .cfg rg/toolchain@v0.0.1-go1.25.5.linux-amd64/pkg/tool/linux_amd64/vet -p os/exec -lang=go1.25 rg/toolchain@v0.0.1-go1.25.5.linux-amd64/pkg/too-buildtags 0664�� om/yuin/goldmark@v1.7.8/text/package.go Alderson@users.noreply.github.com&gt; pkg/mod/golang.org/toolchain@v0.0.1-go1.25.5.lin-nilfunc . iles,SysoFiles,C-d --64 pkg/mod/golang.org/toolchain@v0.0.1-go1.25.5.lin-tests (dns block)
    • Triggering command: /update-job-proxy /update-job-proxy -o br-6ce4892874d9 -j DROP ot_CA_2021.pem -e /opt/go/bin/test -e s/,/_/g ndor/bin/git test -e f727ac7.0 pkg/mod/golang.org/toolchain@v0.0.1-go1.25.5.lin--others /bin/test 4239e8ecaa79ba8c/usr/sbin/iptables /tmp/go-build401--wait p/bin/git test (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Fix implementation of Claude Sonnet 4.5 model Fix ANSI color overflow in split-pane layout Jan 22, 2026
Copilot AI requested a review from ShepAlderson January 22, 2026 01:33
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