fix(cli): restore fallback paste collapse + handle long single-line pastes (#32447)
Follow-up to #32087 after community report from @ethernet that 8000-char single-line pastes get dumped raw into the input box. A) Fallback regression revert paste_collapse_threshold_fallback default: 0 -> 5 #32087 disabled the fallback handler by default. The fallback path has been always-on with line_count >= 5 since #3065 (March 2026); the previous shape was the salvaged contributor's design and didn't match pre-existing behavior for terminals without bracketed paste support (Windows terminals, some SSH setups). Restoring the original on-by-default. B) Long single-line paste guard New config key: paste_collapse_char_threshold (default 2000) Bracketed-paste handler and fallback handler now BOTH collapse when line count >= line threshold OR total char length >= char threshold. Catches the case ethernet hit: ~8000 chars of minified JSON / log output on a single line dumped raw into the buffer. TUI mirrors the same config via uiStore.pasteCollapseChars. Set 0 to disable. Defaults verified: paste_collapse_threshold: 5 paste_collapse_threshold_fallback: 5 paste_collapse_char_threshold: 2000 Tests: tests/hermes_cli/test_config.py: 87/87 pass ui-tui useConfigSync.test.ts: 34/34 pass ui-tui useComposerState.test.ts: 9/9 pass tsc: 0 new errors in touched files
This commit is contained in:
+18
-6
@@ -1905,13 +1905,25 @@ DEFAULT_CONFIG = {
|
||||
},
|
||||
|
||||
# Paste collapse thresholds (TUI + CLI).
|
||||
# collapse_threshold: paste collapses to a file reference when line count
|
||||
# exceeds this value (bracketed paste, safe: appends to existing text).
|
||||
# collapse_threshold_fallback: same but for the fallback heuristic used
|
||||
# by terminals without bracketed paste support (destructive: replaces
|
||||
# entire buffer). 0 = disabled.
|
||||
#
|
||||
# paste_collapse_threshold (default 5)
|
||||
# Bracketed-paste handler. Pastes with this many newlines or more
|
||||
# collapse to a file reference. Set 0 to disable.
|
||||
#
|
||||
# paste_collapse_threshold_fallback (default 5)
|
||||
# Fallback heuristic for terminals without bracketed paste support.
|
||||
# Same line count test but heuristically gated by chars-added /
|
||||
# newlines-added to avoid false positives from normal typing.
|
||||
# Set 0 to disable.
|
||||
#
|
||||
# paste_collapse_char_threshold (default 2000)
|
||||
# Long single-line paste guard. Pastes whose total char length
|
||||
# reaches this value collapse to a file reference even if line
|
||||
# count is below the line threshold. Catches the "8000 chars of
|
||||
# minified JSON / log output on one line" case. Set 0 to disable.
|
||||
"paste_collapse_threshold": 5,
|
||||
"paste_collapse_threshold_fallback": 0,
|
||||
"paste_collapse_threshold_fallback": 5,
|
||||
"paste_collapse_char_threshold": 2000,
|
||||
|
||||
|
||||
# Config schema version - bump this when adding new required fields
|
||||
|
||||
Reference in New Issue
Block a user