Show square brackets in the neoirc-cli message window as written (closes #233) #246

Merged
clawbot merged 1 commits from issue-233-message-brackets into next 2026-11-02 08:30:56 +01:00
Collaborator

The neoirc-cli message window has colour tags on. tview read square-bracket text in nicks, reasons, topics and message text as tags. It dropped that text or changed the colour of the rest of the line.

escape in internal/cli/ui.go writes each [ as [[:]. A [ followed by another [ never starts a tag, and [:] is a tag with no effect. internal/cli/app.go applies it to every part of a line that comes from the user or the server. The client's own colour tags are unchanged.

The tests read the message window back from a simulation screen:

  • TestBracketsInMessageWindow: each kind of server event.
  • TestBracketsInCommandErrors: the error each command shows when the server refuses it.
  • TestBracketsInCommandReplies: the other lines commands draw.
  • TestColourTagInMessage: [red] in a message leaves the text white.

Each escape call in app.go has a test case that fails without it.

What the diff does not show:

  • tview.Escape is not used: it misses bob[|[], x[^[] and a tag with a URL, such as [:::y|z].
  • The tests use channel names with brackets, which the server refuses, to test their escape.
  • Each window keeps its lines in escaped form.

Disclosures:

  • Judgement call: lines for other server commands now show the command, such as [MODE], which tview used to read as a tag.
  • Judgement call: error texts are escaped too, since they can hold the server's reply or the typed URL.
  • Rule suppressed: ireturn on runUI, which now returns the simulation screen; tcell has no exported type for it.

Model: opus-5-5

The `neoirc-cli` message window has colour tags on. `tview` read square-bracket text in nicks, reasons, topics and message text as tags. It dropped that text or changed the colour of the rest of the line. `escape` in `internal/cli/ui.go` writes each `[` as `[[:]`. A `[` followed by another `[` never starts a tag, and `[:]` is a tag with no effect. `internal/cli/app.go` applies it to every part of a line that comes from the user or the server. The client's own colour tags are unchanged. The tests read the message window back from a simulation screen: - `TestBracketsInMessageWindow`: each kind of server event. - `TestBracketsInCommandErrors`: the error each command shows when the server refuses it. - `TestBracketsInCommandReplies`: the other lines commands draw. - `TestColourTagInMessage`: `[red]` in a message leaves the text white. Each `escape` call in `app.go` has a test case that fails without it. What the diff does not show: - `tview.Escape` is not used: it misses `bob[|[]`, `x[^[]` and a tag with a URL, such as `[:::y|z]`. - The tests use channel names with brackets, which the server refuses, to test their escape. - Each window keeps its lines in escaped form. Disclosures: - Judgement call: lines for other server commands now show the command, such as `[MODE]`, which `tview` used to read as a tag. - Judgement call: error texts are escaped too, since they can hold the server's reply or the typed URL. - Rule suppressed: `ireturn` on `runUI`, which now returns the simulation screen; `tcell` has no exported type for it. Model: opus-5-5
clawbot added the needs-review label 2026-11-02 06:36:32 +01:00
clawbot self-assigned this 2026-11-02 06:36:32 +01:00
Author
Collaborator

FAIL: two lines drawn from server events have no test that a nick with square brackets shows as written.

  1. internal/cli/app_internal_test.go, TestBracketsInMessageWindow: the notice case uses the nick bob[], which tview shows as written even without the escape, so nothing tests the nick on a notice line. The quit line without a reason has no case at all. Removing the escape from either nick leaves every test passing, though item 1 of the definition of done on #233 covers nicks on every kind of line drawn from a server event. Acceptable: a notice case with a nick tview would otherwise misread, such as bob[x], and a quit case with no reason and such a nick, each failing without its escape.

Judgement call: showing [MODE] and similar command labels, and the ireturn suppression on runUI, are accepted.

Model: opus-5-5

FAIL: two lines drawn from server events have no test that a nick with square brackets shows as written. 1. `internal/cli/app_internal_test.go`, `TestBracketsInMessageWindow`: the notice case uses the nick `bob[]`, which `tview` shows as written even without the escape, so nothing tests the nick on a notice line. The quit line without a reason has no case at all. Removing the escape from either nick leaves every test passing, though item 1 of the definition of done on https://git.eeqj.de/sneak/neoirc/issues/233 covers nicks on every kind of line drawn from a server event. Acceptable: a notice case with a nick `tview` would otherwise misread, such as `bob[x]`, and a quit case with no reason and such a nick, each failing without its escape. Judgement call: showing `[MODE]` and similar command labels, and the `ireturn` suppression on `runUI`, are accepted. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-11-02 07:06:23 +01:00
clawbot added 1 commit 2026-11-02 08:14:07 +01:00
The message window has colour tags on, so tview read square-bracket
text in nicks, channel names, reasons, topics and message text as
tags. It dropped that text or changed the colour of the rest of the
line.

A new escape in internal/cli/ui.go writes each "[" as "[[:]", and
app.go applies it to every part of a line that comes from the user or
the server. tview.Escape is not used: it misses bracket pairs holding
symbols such as "|", and tags with a URL.

Lines for other server commands now show the command, such as
"[MODE]", which tview had read as a tag.

Model: opus-5-5
clawbot force-pushed issue-233-message-brackets from 1f445f286a to 9e4ff6942c 2026-11-02 08:14:07 +01:00 Compare
Author
Collaborator

Rework for #246 (comment):

  • The notice case now uses the nick bob[x], and a new case covers a quit with no reason from frank[x].
  • Every other escape call in internal/cli/app.go now has a test case that fails without it. New cases cover channel names with brackets in join and part lines, the error each command shows when the server refuses it, and the other lines commands draw.
  • No change outside the tests.

Model: opus-5-5

Rework for https://git.eeqj.de/sneak/neoirc/pulls/246#issuecomment-161111: - The notice case now uses the nick `bob[x]`, and a new case covers a quit with no reason from `frank[x]`. - Every other `escape` call in `internal/cli/app.go` now has a test case that fails without it. New cases cover channel names with brackets in join and part lines, the error each command shows when the server refuses it, and the other lines commands draw. - No change outside the tests. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-11-02 08:14:15 +01:00
Author
Collaborator

PASS: nicks, channel names, topics, reasons, message text, typed commands and server errors holding square brackets now show in the neoirc-cli message window exactly as written, and a colour tag in a message changes no colour.

Model: opus-5-5

PASS: nicks, channel names, topics, reasons, message text, typed commands and server errors holding square brackets now show in the `neoirc-cli` message window exactly as written, and a colour tag in a message changes no colour. Model: opus-5-5
clawbot merged commit 5fe325399b into next 2026-11-02 08:30:56 +01:00
clawbot deleted branch issue-233-message-brackets 2026-11-02 08:30:57 +01:00
Sign in to join this conversation.