Skip to content

cmd_userinfo: value column is ragged - fixed tab count after variable-width (translated) labels #459

Description

@Aybook

Symptom

The +userinfo value column does not line up. It jumps between two positions, and the Sent: / Received: pair sits offset from the block above it:

Nick: 		[HUBOWNER]Aybo
Version:  		AirDC++ 4.30      <- value pushed further right than the lines above
SID:  		RXVV
...
Sent:        	686 B             <- these two land in a different column
Received: 	41.68 KB

Cosmetic only, no functional impact. Pre-existing since cmd_userinfo v0.14 ("using tabs for cleaner look"); not introduced by the #447 dead-code sweep, which only removed the unused msg_denied local from this plugin.

Root cause

The line is assembled from two places:

Tabs snap to 8-column stops, so with a fixed tab count the value column depends on label length: a short label like SID: lands the value at column 16, but Version: (10 chars) pushes it to column 24. That is the raggedness.

Second, separate defect: Sent: and Received: are prepended with a single "\t" (:239-240) while every other field uses "\t\t". That is why those two lines are visibly offset from the block above. This half is a trivial fix on its own.

Why it is not a one-liner: the labels are translated

Tabs were originally chosen precisely because the labels are in the lang file and differ per language. The German file translates some labels and not others - Gesendet: (9) / Empfangen: (10) vs English Sent: (5) / Received: (9), while Nick: / Share: / Version: stay English (scripts/lang/cmd_userinfo.lang.de). So the column math is different in each language, and any fix has to be done per language and touch .en + .de together (guarded by plugin_lang_test.lua).

Fix options

  1. Space-pad each label to a fixed width and drop the leading tabs. Deterministic regardless of the client's tab-stop width (DC++ / AirDC++ / NMDC bridges all render tabs differently). Downside: the pad width is per-language and has to be maintained if a label is retranslated.
  2. Keep tabs but make the count clear the longest label in each language, and normalize the trailing spaces. Less churn, but still depends on the client rendering an 8-column tab stop, so alignment is not guaranteed across clients.

Recommend (1): space-padding in a monospace chat is the only client-independent alignment. The Sent/Received single-tab normalization rides along in the same PR. scriptversion bump on the fix (behaviour-neutral, but user-visible output changes).

Not in scope

Whether Sent/Received map to the right rstat/sstat is a separate question and not asserted here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Fields

No fields configured for Bug.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions