From 0c697d9ba92c3814577d6de4af0769f3cc9ca3f9 Mon Sep 17 00:00:00 2001 From: Aleksei Sviridkin Date: Tue, 22 Sep 2026 22:16:34 +0300 Subject: [PATCH] fix(segments): keep status icons out of the repo and PR links The OSC 8 link wrapped the whole part, so the host or review icon and the space before the text were underlined and clickable along with it. Only the repository name and the PR number are links now. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin --- cmd/claudeline/main.go | 6 +++--- cmd/claudeline/main_test.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/claudeline/main.go b/cmd/claudeline/main.go index 2600bab..c9805da 100644 --- a/cmd/claudeline/main.go +++ b/cmd/claudeline/main.go @@ -472,7 +472,7 @@ func formatRepoSegment(data *stdinData) string { repo := data.Workspace.Repo icon, prefix := repoHostIcon(repo.Host) - parts := []string{fmtutil.Link(fmtutil.Part(prefix+repo.Owner+"/"+repo.Name, icon), repoURL(repo))} + parts := []string{fmtutil.Part(fmtutil.Link(prefix+repo.Owner+"/"+repo.Name, repoURL(repo)), icon)} if data.PR != nil && data.PR.Number > 0 { sigil := "#" @@ -480,12 +480,12 @@ func formatRepoSegment(data *stdinData) string { sigil = "!" } - number := fmt.Sprintf("%s%d", sigil, data.PR.Number) + number := fmtutil.Link(fmt.Sprintf("%s%d", sigil, data.PR.Number), data.PR.URL) if state := prReviewIcon(data.PR.ReviewState); state != "" { number = fmtutil.Part(number, state) } - parts = append(parts, fmtutil.Link(number, data.PR.URL)) + parts = append(parts, number) } parts = append(parts, worktreeBranchParts(data)...) diff --git a/cmd/claudeline/main_test.go b/cmd/claudeline/main_test.go index acc283a..c6fa58b 100644 --- a/cmd/claudeline/main_test.go +++ b/cmd/claudeline/main_test.go @@ -1746,12 +1746,12 @@ func TestBuildStatuslineLinksRepoAndPR(t *testing.T) { got := buildStatusline([]byte(input), defaultCfg()) - wantRepo := "\x1b]8;;https://github.com/lexfrei/claudeline\x07🐙 lexfrei/claudeline\x1b]8;;\x07" + wantRepo := "🐙 \x1b]8;;https://github.com/lexfrei/claudeline\x07lexfrei/claudeline\x1b]8;;\x07" if !strings.Contains(got, wantRepo) { t.Errorf("expected linked repo %q in %q", wantRepo, got) } - wantPR := "\x1b]8;;https://github.com/lexfrei/claudeline/pull/42\x07✅ #42\x1b]8;;\x07" + wantPR := "✅ \x1b]8;;https://github.com/lexfrei/claudeline/pull/42\x07#42\x1b]8;;\x07" if !strings.Contains(got, wantPR) { t.Errorf("expected linked PR %q in %q", wantPR, got) } @@ -1793,7 +1793,7 @@ func TestBuildStatuslineLinksSelfHostedRepo(t *testing.T) { got := buildStatusline([]byte(input), defaultCfg()) - want := "\x1b]8;;https://git.example.com/o/r\x07📦 git.example.com/o/r\x1b]8;;\x07" + want := "📦 \x1b]8;;https://git.example.com/o/r\x07git.example.com/o/r\x1b]8;;\x07" if !strings.Contains(got, want) { t.Errorf("expected linked repo %q in %q", want, got) }