runtime: implement an extensible line editor

the line editor supports custom keybinds and data storage, allowing for
a wide range of functionality to be implemented via plugins.

included plugins include:
* core: basic input and cursor movement.
* history: input history storage and retrieval (unfinished)
* highlight: support for colour-highlighting the line buffer (unfinished)
* syntax: parses the line buffer and uses `highlight` to apply syntax highlighting (unfinished).
* shell-integration:
  - allows a `prompt` function to be defined, which will be called to get the text to
    be used for the prompt
  - exposes key properties of the line editor to the shell environment, allowing line editor
    functionality to be extended via shell scripts.
This commit is contained in:
2026-06-20 15:13:34 +01:00
parent f622c2eba3
commit ad8b284869
21 changed files with 1857 additions and 1 deletions
+22
View File
@@ -0,0 +1,22 @@
#ifndef _KEYBIND_H_
#define _KEYBIND_H_
#include <bshell/line-editor/keybind.h>
#include <fx/bst.h>
#include <fx/term/tty.h>
struct keybind {
fx_bst_node b_node;
unsigned long b_priority;
bshell_line_ed_keybind_callback_t b_callback;
};
struct keymap_entry {
fx_bst_node e_node;
fx_keycode e_code;
fx_bst e_binds;
};
extern void line_ed_cleanup_keymap(fx_bst *keymap);
#endif