LibLine: Use grapheme clusters for cursor management

This makes using the line editor much nicer when multi-code-point
graphemes are present in the input (e.g. flag emojis, or some cjk
glyphs), and avoids messing up the buffer when deleting text, or
cursoring around.
This commit is contained in:
Ali Mohammad Pur 2023-12-15 15:01:58 +03:30 committed by Andreas Kling
commit 36f0499cc8
Notes: sideshowbarker 2024-07-17 10:10:18 +09:00
5 changed files with 58 additions and 48 deletions

View file

@ -161,7 +161,7 @@ public:
void register_key_input_callback(Key key, Function<bool(Editor&)> callback) { register_key_input_callback(Vector<Key> { key }, move(callback)); }
static StringMetrics actual_rendered_string_metrics(StringView, RedBlackTree<u32, Optional<Style::Mask>> const& masks = {}, Optional<size_t> maximum_line_width = {});
static StringMetrics actual_rendered_string_metrics(Utf32View const&, RedBlackTree<u32, Optional<Style::Mask>> const& masks = {});
static StringMetrics actual_rendered_string_metrics(Utf32View const&, RedBlackTree<u32, Optional<Style::Mask>> const& masks = {}, Optional<size_t> maximum_line_width = {});
Function<Vector<CompletionSuggestion>(Editor const&)> on_tab_complete;
Function<void(Utf32View, Editor&)> on_paste;