mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:07:34 +00:00
LibGUI: Make the Clipboard API deal in raw byte buffers a bit more
To open up for putting not just text/plain content on the clipboard, let's make the GUI::Clipboard API a bit more raw-data-friendly. :^)
This commit is contained in:
parent
802f541184
commit
51146e3075
12 changed files with 43 additions and 38 deletions
|
@ -550,7 +550,7 @@ void TerminalWidget::paste()
|
|||
auto text = GUI::Clipboard::the().data();
|
||||
if (text.is_empty())
|
||||
return;
|
||||
int nwritten = write(m_ptm_fd, text.characters(), text.length());
|
||||
int nwritten = write(m_ptm_fd, text.data(), text.size());
|
||||
if (nwritten < 0) {
|
||||
perror("write");
|
||||
ASSERT_NOT_REACHED();
|
||||
|
@ -560,7 +560,7 @@ void TerminalWidget::paste()
|
|||
void TerminalWidget::copy()
|
||||
{
|
||||
if (has_selection())
|
||||
GUI::Clipboard::the().set_data(selected_text());
|
||||
GUI::Clipboard::the().set_plain_text(selected_text());
|
||||
}
|
||||
|
||||
void TerminalWidget::mouseup_event(GUI::MouseEvent& event)
|
||||
|
@ -829,7 +829,7 @@ void TerminalWidget::context_menu_event(GUI::ContextMenuEvent& event)
|
|||
m_context_menu_for_hyperlink->add_action(action);
|
||||
}
|
||||
m_context_menu_for_hyperlink->add_action(GUI::Action::create("Copy URL", [this](auto&) {
|
||||
GUI::Clipboard::the().set_data(m_context_menu_href);
|
||||
GUI::Clipboard::the().set_plain_text(m_context_menu_href);
|
||||
}));
|
||||
m_context_menu_for_hyperlink->add_separator();
|
||||
m_context_menu_for_hyperlink->add_action(copy_action());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue