neoirc-cli reads square brackets in nicks and messages as colour tags #233

Closed
opened 2026-11-02 02:53:40 +01:00 by clawbot · 1 comment
Collaborator

In neoirc-cli, the message window has colour tags turned on (internal/cli/ui.go), and the event handlers in internal/cli/app.go write nicks, channel names and message text into it as they are, such as handlePrivmsgEvent, handleJoinEvent and handlePartEvent. tview reads any square-bracket text in them as a colour tag. So <erin[away]> shows as <erin>, and a message holding [red] turns the rest of the line red. Found by the review of #231, which fixed the same fault in the status bar; read from the code on 6387d68.

Fix: everything the client writes into the message window that comes from the user or the server (nicks, channel names, targets, topics, reasons, message and notice text) shows exactly as written, while the client's own colours stay. tview.Escape alone does not cover every bracket shape tview reacts to (see the review on #231), so check the escape against the cases there. Change nothing else.

Definition of done

  1. A nick, channel name, topic, reason or message text holding square brackets shows in the message window exactly as written, on every kind of line the client draws from a server event.
  2. A message holding a colour tag such as [red] shows as written and changes no colour.
  3. The client's own colours (timestamps, nicks, *** lines, /help) look as before.
  4. A test in internal/cli that reads the message window back from a running UI on a tcell simulation screen, with cases such as erin[away], bob[|[] and [red].
  5. One reviewed PR against next.

Model: opus-5-5

In `neoirc-cli`, the message window has colour tags turned on (`internal/cli/ui.go`), and the event handlers in `internal/cli/app.go` write nicks, channel names and message text into it as they are, such as `handlePrivmsgEvent`, `handleJoinEvent` and `handlePartEvent`. `tview` reads any square-bracket text in them as a colour tag. So `<erin[away]>` shows as `<erin>`, and a message holding `[red]` turns the rest of the line red. Found by the review of https://git.eeqj.de/sneak/neoirc/pulls/231, which fixed the same fault in the status bar; read from the code on `6387d68`. Fix: everything the client writes into the message window that comes from the user or the server (nicks, channel names, targets, topics, reasons, message and notice text) shows exactly as written, while the client's own colours stay. `tview.Escape` alone does not cover every bracket shape `tview` reacts to (see the review on https://git.eeqj.de/sneak/neoirc/pulls/231), so check the escape against the cases there. Change nothing else. ## Definition of done 1. A nick, channel name, topic, reason or message text holding square brackets shows in the message window exactly as written, on every kind of line the client draws from a server event. 2. A message holding a colour tag such as `[red]` shows as written and changes no colour. 3. The client's own colours (timestamps, nicks, `***` lines, `/help`) look as before. 4. A test in `internal/cli` that reads the message window back from a running UI on a `tcell` simulation screen, with cases such as `erin[away]`, `bob[|[]` and `[red]`. 5. One reviewed PR against `next`. Model: opus-5-5
Author
Collaborator

Built in #246. Every part of a message-window line that comes from the user or the server now goes through one escape, which writes each [ as [[:]. tview reads neither part as a tag, so the text shows as written and the client keeps its own colours.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/neoirc/pulls/246. Every part of a message-window line that comes from the user or the server now goes through one escape, which writes each `[` as `[[:]`. `tview` reads neither part as a tag, so the text shows as written and the client keeps its own colours. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/neoirc#233