Files
b87e218506 docs(input listen): describe the actual --raw fields and key_type variants (#19517)
## Description

Fixes #19519

`input listen --raw` and `std/input display --raw` both documented a
`raw_flags` field that does not exist. The implementation emits
`raw_modifiers` instead:

```console
$ printf 'a' | script -qfec "nu -n -c 'input listen --types [key] --raw | to nuon'" /dev/null
{type: key, key_type: char, code: a, modifiers: [], raw_code: 97, raw_modifiers: 0}

$ printf '\033OP' | script -qfec "nu -n -c 'input listen --types [key] --raw | to nuon'" /dev/null
{type: key, key_type: f, code: "1", modifiers: [], raw_modifiers: 0}
```

So `raw_modifiers` is added to key and mouse events, while `raw_code` is
added
only for character keys (`create_key_event` pushes it inside
`if let KeyCode::Char(c)`). The old help said neither of these.

This also fixes two related gaps in `extra_description`:

- It listed "4 `key_type` variants", but `get_keycode_name` has a fifth,
`KeyCode::Modifier(m) => "modifier"` (crossterm maps these through the
kitty
  keyboard protocol, e.g. `ModifierKeyCode::LeftShift`).
- It listed the five base event shapes without mentioning the extra
fields
  added under `--raw`.

Help text only — no behavior change. Two files:
`crates/nu-command/src/platform/input/input_listen.rs` and
`crates/nu-std/std/input/mod.nu`.

## User-facing changes (Release notes)

- n/a (documentation only; no behavior change)

## Additional notes

- Verified with a rebuilt `nu` binary that `help input listen` and
  `help display` render the corrected text, and that `--raw` output is
  unchanged for both a character key and F1.
- `cargo test -p nu-command --lib`: 953 passed / 0 failed / 2 ignored.
Example tests: 261 passed / 0 failed. `cargo fmt --check` and the
`typos`
  check on both changed files are clean.
- Related: #15868 (older report about `input listen`'s wrong output-type
docs),
  #19513 (the output-type fix). This PR does not close either.

Co-authored-by: wangjianjun <passionworkeer@users.noreply.github.com>
Co-authored-by: wangjianjun <opuswang@tencent.com>
2026-11-14 09:03:54 -06:00
..