mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:47:46 +00:00
LibLine: Allow the embedder to optionally handle pasted data itself
If the 'on_paste' callback is set, LibLine will buffer the pasted data and pass it over to the embedder to use as it pleases; in practice, this means that the users of LibLine can now escape or otherwise handle pasted data without the incremental codepoint-by-codepoint buildup.
This commit is contained in:
parent
0ea775f257
commit
d7d847c8c6
2 changed files with 14 additions and 1 deletions
|
@ -163,6 +163,7 @@ public:
|
|||
static StringMetrics actual_rendered_string_metrics(Utf32View const&);
|
||||
|
||||
Function<Vector<CompletionSuggestion>(Editor const&)> on_tab_complete;
|
||||
Function<void(Utf32View, Editor&)> on_paste;
|
||||
Function<void()> on_interrupt_handled;
|
||||
Function<void(Editor&)> on_display_refresh;
|
||||
|
||||
|
@ -316,6 +317,7 @@ private:
|
|||
m_chars_touched_in_the_middle = 0;
|
||||
m_drawn_end_of_line_offset = 0;
|
||||
m_drawn_spans = {};
|
||||
m_paste_buffer.clear_with_capacity();
|
||||
}
|
||||
|
||||
void refresh_display();
|
||||
|
@ -491,6 +493,8 @@ private:
|
|||
|
||||
RefPtr<Core::Notifier> m_notifier;
|
||||
|
||||
Vector<u32> m_paste_buffer;
|
||||
|
||||
bool m_initialized { false };
|
||||
bool m_refresh_needed { false };
|
||||
Vector<int, 2> m_signal_handlers;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue