zot/internal
patriceckhart c4150ce630 tweak(tui): two-threshold paste collapse with line-vs-char shape
Before: any paste with >= 2 newlines (3+ lines) collapsed to
[pasted text #N +L lines]. That fired too eagerly on short
three-line snippets the user wants to see inline, and never
fired on a 2000-character single-line dump that bloats the
editor just as badly.

New rule matches the shape widely used in other TUIs:

  collapse when
    lines > 10         OR
    chars > 1000

Both triggers produce distinct placeholder shapes so you can
see at a glance which dimension tripped it:

  [pasted text #1 +12 lines]   line trigger
  [pasted text #1 1500 chars]  char trigger

When both triggers hit (e.g. 12 lines of 400 chars each) the
line-count shape wins \u2014 "+12 lines" reads more informatively
than a raw character count for multi-line content.

Implementation:

  - pasteCollapseLineThreshold  = 10
  - pasteCollapseCharThreshold  = 1000
  - pasteShouldCollapse checks countLines(s) > 10 || len(s) > 1000
  - formatPastePlaceholder picks the shape; line trigger wins
    on ties
  - pastePlaceholderRE widened with a non-capturing alternation
    (\+\d+ lines?|\d+ chars?) so expansion works for both
    shapes; capture group 1 is still just the id
  - the strings.Contains fast-path in SubmitValue still matches
    both shapes because both start with the same prefix

Tests rewritten around the new thresholds:

  - TestPasteCollapseLineTrigger    11 lines -> +11 lines marker
  - TestPasteCollapseCharTrigger    1500 chars, 1 line -> N chars
  - TestPasteCollapseLinePrecedence 12 lines of 400 chars each ->
                                    line shape wins
  - TestPasteCollapseFallthrough    1 line / 2 lines / 10 lines /
                                    1000 chars / 5 lines under
                                    caps all stay inline
  - TestPasteCollapseSequentialIDs  mixed-shape placeholders
                                    coexist, both expand
  - TestPasteCollapseClearResetsMap unchanged logic, updated body
                                    to trigger the new threshold
2026-04-21 17:13:23 +02:00
..
agent feat(tui): /login shows current status for each provider 2026-04-21 16:56:49 +02:00
assets assets: refresh zot logo to cleaner pixel-art Z 2026-04-20 12:01:43 +02:00
auth feat(auth,tui): dark login pages + /logout picker 2026-04-19 20:14:22 +02:00
core feat(session): /session fork + /session tree 2026-04-20 11:10:56 +02:00
extproto feat(ext): phase 4 - full-event interception, arg rewrites, /reload-ext 2026-04-19 17:02:04 +02:00
provider perf(anthropic): fix cost double-count, tighten caching, correct catalog 2026-04-19 18:57:18 +02:00
skills perf(prompt): cut system prompt to the bone (410 -> 54 tokens) 2026-04-19 17:39:38 +02:00
tui tweak(tui): two-threshold paste collapse with line-vs-char shape 2026-04-21 17:13:23 +02:00