1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//! Chat-title normalization — pure string logic, shared by the list's `F2`
//! editor, `/rename`, the model-written title cleaner and (from the sub-agent
//! track on) a storage migration step that names a synthesized transcript
//! (docs/research/subagent-chats.md §3.13). It lives in `shared` because a
//! migration step cannot reach `features` (FSD: dependencies point downward).
//! See spec §11.2.
/// Normalizes user-entered title input: trims the outer whitespace,
/// collapses internal line breaks/tabs into a space, and collapses repeated
/// spaces. Returns `None` if the string is empty after normalization (the
/// rename is rejected — the old title is kept).
///
/// **Length is not bounded here** (the user's decision of 2026-09-06). A cap
/// used to cut the title at 100 characters, and a cut made in storage arrives
/// at a screen looking whole: a run named after the first line of its
/// instruction ended mid-word on a maximized window with columns to spare and
/// read as its own full name. A title is now cut only where it does not fit —
/// by the surface drawing it, in columns, with the "…" every such cut carries
/// (`wrap::truncate_to_width`, spec §11.2). Every surface that draws a title
/// in a fixed row must therefore do that cut itself; the ones that wrap
/// (the search screen, a feed note) need nothing.