pub fn ctrl_to_arrow(ke: KeyEvent) -> KeyEventExpand description
Map WordStar Ctrl-letter navigation keys to their arrow/nav equivalents.
In the decomposed key model, a Ctrl-letter is Key::Char(letter) with
modifiers.ctrl set. The 11-entry table maps:
| Ctrl+ | → Key |
|---|---|
| S | Left |
| D | Right |
| E | Up |
| X | Down |
| A | Home |
| F | End |
| G | Delete |
| V | Insert |
| R | PageUp |
| C | PageDown |
| H | Backspace |
The letter is matched case-insensitively. On a match the resulting
KeyEvent has all modifiers cleared (only the base arrow/nav key is
returned). Any key that does not match — including literal arrow keys,
non-Char keys, or Char keys without ctrl — is returned unchanged.
When to call: pass an incoming KeyDown event through this function
before dispatching it for navigation — e.g. in InputLine::handle_event
and Editor::handle_event — so that applications supporting WordStar-style
navigation can use either arrow keys or the traditional Ctrl-letter chords.
Widgets that do not want WordStar mode (e.g. plain text fields that use
Ctrl letters for cut/copy/paste) should skip this call.
§Turbo Vision heritage
Ports ctrlToArrow (drivers2.cpp).