Shell: Start adding some alt shortcuts

This adds Alt-f to go forward by a word, and Alt-b to go backward
by a word (like ctrl-arrow-left / ctrl-arrow-right already do).

Behind the scenes, alt-key is implemented by sending <esc> followed
by that key, and typing <esc> f/b for moving by a word hence works
too (in all other shells too, not just in Serenity's).

While here, rename some InputState enum values to make the slightly
expanded use of <esc> clearer, and expand a few comments.
This commit is contained in:
Nico Weber 2020-08-06 10:52:18 -04:00 committed by Andreas Kling
commit 4d9d054386
Notes: sideshowbarker 2024-07-19 04:13:14 +09:00
2 changed files with 26 additions and 17 deletions

View file

@ -377,8 +377,8 @@ private:
enum class InputState {
Free,
ExpectBracket,
ExpectFinal,
GotEscape,
GotEscapeFollowedByLeftBracket,
ExpectTerminator,
};
InputState m_state { InputState::Free };