|
| 1 | +# DECAWM Auto Wrap Mode |
| 2 | + |
| 3 | +## Goal |
| 4 | + |
| 5 | +Expose DEC auto wrap mode (DECAWM, private mode 7) through the root `Tty` |
| 6 | +command surface, without adding terminal-emulator state or capability probing. |
| 7 | + |
| 8 | +## Status |
| 9 | + |
| 10 | +Done. |
| 11 | + |
| 12 | +## Context And Decisions |
| 13 | + |
| 14 | +- DECAWM is controlled with DEC private mode 7: |
| 15 | + - enable: `CSI ? 7 h` |
| 16 | + - disable: `CSI ? 7 l` |
| 17 | +- This is an output-side terminal mode switch. It does not affect the input |
| 18 | + event model. |
| 19 | +- Do not add a scoped `with_auto_wrap` helper. The package does not track the |
| 20 | + previous terminal mode state, and forcing a fixed restore value could undo a |
| 21 | + caller or terminal preference. |
| 22 | +- Unsupported terminals can ignore the mode switch; no support query is added. |
| 23 | + |
| 24 | +## References Or Standards |
| 25 | + |
| 26 | +- DEC private mode 7, commonly named DECAWM. |
| 27 | + |
| 28 | +## Target Files |
| 29 | + |
| 30 | +- `internal/vt/screen.mbt` |
| 31 | +- `internal/vt/screen_test.mbt` |
| 32 | +- `style.mbt` |
| 33 | +- `tty_wbtest.mbt` |
| 34 | +- `README.md` |
| 35 | +- `docs/architecture.md` |
| 36 | +- `docs/plan.md` |
| 37 | +- generated `.mbti` files from `moon info` |
| 38 | + |
| 39 | +## Public API Changes |
| 40 | + |
| 41 | +Root package additions: |
| 42 | + |
| 43 | +- `Tty::enable_auto_wrap(Self) -> Unit` |
| 44 | +- `Tty::disable_auto_wrap(Self) -> Unit` |
| 45 | + |
| 46 | +Internal VT package additions: |
| 47 | + |
| 48 | +- `enable_auto_wrap : Bytes` |
| 49 | +- `disable_auto_wrap : Bytes` |
| 50 | + |
| 51 | +No new public type, parser state, input event, platform backend, or capability |
| 52 | +query is proposed. |
| 53 | + |
| 54 | +## Invariants |
| 55 | + |
| 56 | +- `Tty` remains the public output-command surface. |
| 57 | +- `internal/vt` remains byte-sequence-only and does not own output streams. |
| 58 | +- The package does not remember or infer terminal auto-wrap state. |
| 59 | +- DECAWM support does not add a screen model, renderer, layout layer, or |
| 60 | + terminal-emulator state. |
| 61 | + |
| 62 | +## Acceptance Criteria |
| 63 | + |
| 64 | +- Internal VT helpers emit `CSI ? 7 h` and `CSI ? 7 l`. |
| 65 | +- Root command helpers write the same bytes through `Tty`. |
| 66 | +- Generated `.mbti` diffs contain only the intended API additions. |
| 67 | + |
| 68 | +## Validation Commands |
| 69 | + |
| 70 | +- `moon fmt` passed. |
| 71 | +- `moon test internal/vt` passed: 17 tests. |
| 72 | +- `moon test .` passed: 24 tests. |
| 73 | +- `moon check` passed. |
| 74 | +- `moon info` passed and regenerated intended `.mbti` entries. |
| 75 | +- `git diff --check` passed. |
| 76 | + |
| 77 | +## Public API Audit |
| 78 | + |
| 79 | +- Root `Tty` now exposes `enable_auto_wrap` and `disable_auto_wrap` for callers |
| 80 | + that need to control DECAWM directly. |
| 81 | +- Internal VT exposes `enable_auto_wrap` and `disable_auto_wrap` byte constants |
| 82 | + for root command methods. |
| 83 | +- No public parser state, platform handle, input event, wrapper type, mutable |
| 84 | + field, or terminal state model was added. |
| 85 | +- The generated `.mbti` diff was reviewed and contains only the intended root |
| 86 | + and internal VT additions. |
| 87 | + |
| 88 | +## Result Notes |
| 89 | + |
| 90 | +- Added fixed DECAWM byte constants and root write-through helpers. |
| 91 | +- Added internal VT sequence tests and root pipe-backed command tests. |
| 92 | +- Updated README, architecture notes, and the execution board. |
| 93 | + |
| 94 | +## Open Questions |
| 95 | + |
| 96 | +- None. |
0 commit comments