Skip to content

[BUG] Wrapped transcript URLs open truncated link on mouse click #103

Description

@Cod-e-Codes

Summary

Left-clicking a long URL in the chat transcript (especially a wrapped GitHub commit link with hyphens in the host) can open a truncated URL in the browser, for example https://github.com/Cod instead of the full commit href.

URL styling (underline, wrap at path boundaries) works. Click-to-open does not reliably open the full URL in real terminals.

Reproduction

  1. Build and run the client from current main (go build -o marchat . then run the client binary).
  2. Connect to a server and post (or receive) a message containing a long URL, for example:
    https://github.com/Cod-e-Codes/marchat/commit/e579461ea4d75e8f4971bcf6095342f7fa2205e1
  3. Use a narrow terminal width so the URL wraps across two or more transcript lines (default layout with user list is often enough).
  4. Left-click the underlined URL on the first line (on the Cod segment).

Expected

The default browser opens the full commit URL.

Actual

The browser opens a truncated prefix such as https://github.com/Cod.

Environment

  • OS: Windows, macOS, or Linux (reported on Windows)
  • Terminal: Windows Terminal or similar with mouse reporting
  • marchat: main after URL click work (not limited to v1.2.0 tag)
  • Server rebuild is not required; this is client-side only

Technical notes

Current approach (client/websocket.go, client/render.go):

  • Underline/color via Lip Gloss styles only (no OSC 8 hyperlink sequences; lipgloss v1.1 in go.mod has no Style.Hyperlink API).
  • Mouse handler maps terminal coordinates through chatPanelOrigin() (header, optional banner, chat box border) into viewport.View() lines, then regex/stitch/buildTranscriptLineURLs/expandClickedURL.

Headless unit tests (client/render_test.go, client/main_test.go) pass but do not model lipgloss box chrome or real emulator click behavior end-to-end.

Proposed direction (not implemented)

Per terminal hyperlink practice (OSC 8, documented by egmontkob and Charm Lip Gloss issue #220 / v2 Hyperlink API):

  1. Emit OSC 8 with the full URL on each visible wrapped segment when the terminal supports it.
  2. Let the emulator handle click when possible; keep openURL + coordinate fallback only where needed.
  3. Add manual test steps in TESTING.md and optional integration test with recorded terminal layout if feasible.

Workaround

Copy the URL from the message text.

Related docs

  • ARCHITECTURE.md (client URL section)
  • ROADMAP.md Phase 7
  • TESTING.md Manual testing gaps

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions