# Koshi 0.6.0 — Terminal input (/docs/v0.6/using/terminal-input)



## Keyboard input [#keyboard-input]

Koshi forwards key presses, repeats, releases, text, and modifiers from the
outer terminal through the session to programs running in panes. Programs can
request the Kitty keyboard protocol to distinguish keys that legacy terminal
bytes encode the same way, such as Enter and Shift+Enter.

The session reads `terminal.extended-keys` from `koshi.kdl`:

| Value                    | Program asked for enhanced input                                                       | Program did not ask                                                                                 |
| ------------------------ | -------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| `"on-request"` (default) | Receives the key details it requested                                                  | Receives legacy key bytes                                                                           |
| `"always"`               | Receives the requested details and enhanced sequences for keys that share legacy bytes | Receives enhanced sequences for keys that share legacy bytes; other keys keep their legacy encoding |

For example, with `"on-request"`, a program that asks for basic key reporting
but not Enter receives the same legacy bytes for Enter and Shift+Enter. With
`"always"`, Shift+Enter gets a Kitty `CSI u` sequence, so a program that
understands the protocol can distinguish it.

Koshi can only forward the key details reported by the outer terminal. If that
terminal reports Shift+Enter as Enter, the distinction is unavailable to pane
programs. See [`terminal.extended-keys`](/docs/v0.6/configuration/koshi-kdl).

```kdl title="koshi.kdl"
version 2

terminal {
    extended-keys "always"
}
```

## Horizontal margins and origin mode [#horizontal-margins-and-origin-mode]

Terminal programs can set left and right margins. Cursor movement, character
insertion and deletion, and scrolling then respect those margins. Origin mode
makes cursor coordinates relative to the active vertical and horizontal
margins. Koshi keeps this terminal state with each pane.
