chore(vendor): import pi 1.3.0

Imported as a linear vendor commit so forge rebases do not replay the upstream root tree.

git-subtree-dir: third_party/pi

git-subtree-split: 71023aec1546d6d677a65669c5665c0927ce0dd0
This commit is contained in:
2026-10-15 17:58:48 -04:00
parent 719370c8f7
commit 6081e3e325
1743 changed files with 205460 additions and 131705 deletions

View File

@@ -1,63 +1,55 @@
# tmux Setup
# Run Pi in tmux
Pi works inside tmux, but tmux strips modifier information from certain keys by default. Without configuration, `Shift+Enter` and `Ctrl+Enter` are usually indistinguishable from plain `Enter`.
Pi works inside tmux, but tmux can report `Shift+Enter`, `Ctrl+Enter`, and plain `Enter` as the same key. Enable extended keys so Pi can distinguish them.
## Recommended Configuration
## Check your tmux version
Add to `~/.tmux.conf`:
```bash
tmux -V
```
For tmux 3.5 or newer, use the recommended CSI-u configuration below. For tmux 3.2 through 3.4, use the older-version configuration.
## Enable extended keys in tmux 3.5 or newer
Add these lines to `~/.tmux.conf`:
```tmux
set -g extended-keys on
set -g extended-keys-format csi-u
```
Then restart tmux fully:
Pi requests extended-key reporting when the terminal does not provide the Kitty keyboard protocol directly. CSI-u is the most reliable format for forwarding modified keys through tmux.
## Restart tmux
The configuration applies to the tmux server. To guarantee that it is active, close your tmux sessions and start a new server.
If you choose to stop the server from the command line, save your work first. This command terminates every session managed by that server:
```bash
tmux kill-server
tmux
```
Pi requests extended key reporting automatically when Kitty keyboard protocol is not available. With `extended-keys-format csi-u`, tmux forwards modified keys in CSI-u format, which is the most reliable configuration. The `extended-keys-format` option requires tmux 3.5 or later.
## Verify modified keys
## Why `csi-u` Is Recommended
Start Pi inside the new tmux session and check that:
With only:
1. `Shift+Enter` inserts a new line in the editor.
2. `Enter` submits the prompt.
3. `Alt+Enter` queues a follow-up on macOS and Linux. Windows and WSL use `Ctrl+Q` by default.
If these keys still behave like plain `Enter`, verify that the terminal outside tmux can report modified keys. See [Configure your terminal](terminal-setup.md).
## Use tmux 3.2 through 3.4
These versions support extended keys but not `extended-keys-format csi-u`. Add only:
```tmux
set -g extended-keys on
```
tmux defaults to `extended-keys-format xterm`. When an application requests extended key reporting, modified keys are forwarded in xterm `modifyOtherKeys` format such as:
Pi supports the xterm `modifyOtherKeys` format used by these versions. Restart tmux and repeat the verification steps.
- `Ctrl+C` → `\x1b[27;5;99~`
- `Ctrl+D` → `\x1b[27;5;100~`
- `Ctrl+Enter` → `\x1b[27;5;13~`
With `extended-keys-format csi-u`, the same keys are forwarded as:
- `Ctrl+C` → `\x1b[99;5u`
- `Ctrl+D` → `\x1b[100;5u`
- `Ctrl+Enter` → `\x1b[13;5u`
Pi supports both formats, but `csi-u` is the recommended tmux setup.
## What This Fixes
Without tmux extended keys, modified Enter keys collapse to legacy sequences:
| Key | Without extkeys | With `csi-u` |
|-----|-----------------|--------------|
| Enter | `\r` | `\r` |
| Shift+Enter | `\r` | `\x1b[13;2u` |
| Ctrl+Enter | `\r` | `\x1b[13;5u` |
| Alt/Option+Enter | `\x1b\r` | `\x1b[13;3u` |
This affects the default keybindings (`Enter` to submit, `Shift+Enter` for newline) and any custom keybindings using modified Enter.
## Requirements
- tmux 3.5 or later for `extended-keys-format csi-u` (run `tmux -V` to check)
- A terminal emulator that supports extended keys (Ghostty, Kitty, iTerm2, WezTerm, Windows Terminal)
With tmux 3.2 through 3.4, omit `extended-keys-format csi-u`; Pi still supports tmux's default xterm `modifyOtherKeys` format.
For older versions, upgrade tmux or use Pi outside tmux rather than relying on modified Enter shortcuts.