waveterm/schema
Drew Goddyn 1fe0fa236c
fix: trim trailing whitespace from terminal clipboard copies (#3167)
Fixes #2778.

## Problem

`xterm.js`'s `getSelection()` returns lines padded to the full terminal
column width. Every copy path passed this directly to
`navigator.clipboard.writeText()`, so pasting into Slack, editors, etc.
included hundreds of trailing spaces.

## Solution

Adds a `term:trimtrailingwhitespace` setting (default `true`) that
strips trailing whitespace from each line before writing to the
clipboard. Applied to all three copy paths:

- copy-on-select (`termwrap.ts`)
- `Ctrl+Shift+C` (`term-model.ts`)
- right-click Copy context menu (`term-model.ts`)

OSC 52 is intentionally excluded — that path copies program-provided
text, not grid content.

The trim itself uses the same per-line `trimEnd()` approach already
present in `bufferLinesToText` via `translateToString(true)`.

Setting to `false` restores the previous behaviour.

## Files changed

- `pkg/wconfig/settingsconfig.go` — new `TermTrimTrailingWhitespace
*bool` field
- `pkg/wconfig/defaultconfig/settings.json` — default `true`
- `frontend/app/view/term/termutil.ts` — `trimTerminalSelection` helper
- `frontend/app/view/term/termwrap.ts` — copy-on-select path
- `frontend/app/view/term/term-model.ts` — Ctrl+Shift+C and right-click
paths
- Generated: `pkg/wconfig/metaconsts.go`, `frontend/types/gotypes.d.ts`,
`schema/settings.json`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 10:24:39 -07:00
..
aipresets.json implement ai:proxyurl for proxy url access to different models (#2263) 2025-08-19 10:19:27 -07:00
backgrounds.json Change presets/bg.json => backgrounds.json, migrate, change tab background to tab:background key (#3108) 2026-03-24 09:00:45 -07:00
connections.json Session Durability Checkpoint (#2821) 2026-02-03 11:49:52 -08:00
settings.json fix: trim trailing whitespace from terminal clipboard copies (#3167) 2026-04-15 10:24:39 -07:00
waveai.json Block Level Indicators/Badges, Update TabBar Styling, Add Badges/Flags to Tabs (#3009) 2026-03-09 13:13:32 -07:00
widgets.json Change presets/bg.json => backgrounds.json, migrate, change tab background to tab:background key (#3108) 2026-03-24 09:00:45 -07:00