]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
console: allow using arrow left/right, home/end keys and history mode (#17836)
authorXuan-Son Nguyen <redacted>
Tue, 9 Dec 2025 10:53:59 +0000 (11:53 +0100)
committerGitHub <redacted>
Tue, 9 Dec 2025 10:53:59 +0000 (11:53 +0100)
commit4e842d5120f0349fe4c014a1cc8b9a55c5715c66
tree3e313b44bf3ea621400210c9c6c834619b3f677f
parentca709e427b1c5cf0134aaabc9bbc0183f32d1df0
console: allow using arrow left/right, home/end keys and history mode (#17836)

* console: allow using arrow left/right to edit the line (with UTF-8 support)

* console: fix arrow keys on Windows using private-use Unicode

* console: add Home/End key support for Windows and Linux

* console: add basic Up/Down history navigation

* fix build

* console: allow using arrow left/right to edit the line (with UTF-8 support)

* console: fix arrow keys on Windows using private-use Unicode

* console: add Home/End key support for Windows and Linux

* console: add basic Up/Down history navigation

* console: remove unreachable wc == 0 check after VK switch

* console: add Ctrl+Left/Right word navigation

- Add KEY_CTRL_ARROW_LEFT and KEY_CTRL_ARROW_RIGHT codes
- Windows: detect CTRL modifier via dwControlKeyState
- Linux: parse ANSI sequences with modifier (1;5D/C)
- Implement move_word_left/right with space-skipping logic
- Refactor escape sequence parsing to accumulate params

* console: add Delete key support

- Windows: VK_DELETE detection
- Linux: ESC[3~ sequence parsing
- Forward character deletion with UTF-8 support

* console: implement bash-style history editing

- Edit any history line during UP/DOWN navigation, edits persist
- Pressing Enter appends edited version as new history entry
- Original line stay untouched in their positions

* clean up

* better history impl

* fix decode_utf8

---------

Co-authored-by: Pascal <redacted>
common/console.cpp