xF: support pasting from clipboard
Alpine 3.24 Success
Arch Linux AUR Success
OpenBSD 7.8 Success

Bump liberty.  Most of the change happens in liberty-xui.
This commit is contained in:
2026-08-10 15:36:07 +02:00
parent 83128dc7bb
commit bb48e185d0
2 changed files with 23 additions and 1 deletions
+1 -1
Submodule liberty updated: bb75c8e4fa...285dacb785
+22
View File
@@ -279,6 +279,7 @@ enum action
ACTION_VIEW_TRANSCRIPT,
ACTION_OPEN,
ACTION_INSERT_NEWLINE,
ACTION_PASTE,
ACTION_FORMAT,
ACTION_FORMAT_BOLD,
ACTION_FORMAT_ITALIC,
@@ -2282,6 +2283,20 @@ app_on_clipboard_copy (const char *text)
print_status ("copied to clipboard: %s", text);
}
static void
app_on_clipboard_paste (const char *text)
{
if (!text)
return;
struct utf8_iter iter = utf8_iter_make (text);
int32_t codepoint = 0;
size_t codepoint_len = 0;
while ((codepoint = utf8_iter_next (&iter, &codepoint_len)) >= 0)
app_editor_insert (codepoint);
xui_invalidate ();
}
static void
app_select_backend (void)
{
@@ -3984,6 +3999,11 @@ app_process_action (enum action action)
case ACTION_INSERT_NEWLINE:
app_editor_insert ('\n');
return true;
case ACTION_PASTE:
if (!g_xui.ui->request_clipboard)
return false;
g_xui.ui->request_clipboard ();
return true;
case ACTION_FORMAT:
g.inserting_attribute = true;
return true;
@@ -4160,6 +4180,8 @@ g_default_bindings[] =
{ "M-E", ACTION_VIEW_TRANSCRIPT }, // xF
{ "C-o", ACTION_OPEN }, // xF
{ "M-Enter", ACTION_INSERT_NEWLINE },
{ "C-v", ACTION_PASTE },
{ "S-Insert", ACTION_PASTE },
{ "M-m", ACTION_FORMAT }, // xC
{ "PageUp", ACTION_SCROLL_UP },
{ "PageDown", ACTION_SCROLL_DOWN },