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
+27
View File
@@ -0,0 +1,27 @@
#include <bshell/line-editor/plugin.h>
struct bshell_line_ed_plugin_p {
};
static void init(fx_object *obj, void *priv)
{
}
static void fini(fx_object *obj, void *priv)
{
}
FX_TYPE_CLASS_BEGIN(bshell_line_ed_plugin)
FX_TYPE_VTABLE_INTERFACE_BEGIN(fx_object, FX_TYPE_OBJECT)
FX_INTERFACE_ENTRY(to_string) = NULL;
FX_TYPE_VTABLE_INTERFACE_END(fx_object, FX_TYPE_OBJECT)
FX_TYPE_CLASS_END(bshell_line_ed_plugin)
FX_TYPE_DEFINITION_BEGIN(bshell_line_ed_plugin)
FX_TYPE_ID(0x6311ff4e, 0x5eb7, 0x48f0, 0x982b, 0xf8ffbda74869);
FX_TYPE_NAME("bshell.runtime.line_editor.plugin");
FX_TYPE_CLASS(bshell_line_ed_plugin_class);
FX_TYPE_INSTANCE_INIT(init);
FX_TYPE_INSTANCE_FINI(fini);
FX_TYPE_INSTANCE_PRIVATE(struct bshell_line_ed_plugin_p);
FX_TYPE_DEFINITION_END(bshell_line_ed_plugin)