diff options
author | networkException <git@nwex.de> | 2022-02-17 11:26:04 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-17 11:56:38 +0100 |
commit | 3052c0578cd9d4772fee925f50d14370cecda926 (patch) | |
tree | a2ac4f898eca57e482b5b2ff4656a242d4363e76 /Userland/Libraries/LibVT/TerminalWidget.cpp | |
parent | 17f5eb558c07952ace178dbb7241a65d830d8e34 (diff) | |
download | serenity-3052c0578cd9d4772fee925f50d14370cecda926.zip |
LibVT: Properly populate context menu with open actions
We would previously overwrite m_hovered_href with tooltip texts instead
of leaving it as an url as was expected by the context menu event
handler.
Diffstat (limited to 'Userland/Libraries/LibVT/TerminalWidget.cpp')
-rw-r--r-- | Userland/Libraries/LibVT/TerminalWidget.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Userland/Libraries/LibVT/TerminalWidget.cpp b/Userland/Libraries/LibVT/TerminalWidget.cpp index 9c51cf93e8..57438b09c1 100644 --- a/Userland/Libraries/LibVT/TerminalWidget.cpp +++ b/Userland/Libraries/LibVT/TerminalWidget.cpp @@ -827,23 +827,21 @@ void TerminalWidget::mousemove_event(GUI::MouseEvent& event) if (attribute.href_id != m_hovered_href_id) { if (m_active_href_id.is_null() || m_active_href_id == attribute.href_id) { m_hovered_href_id = attribute.href_id; + m_hovered_href = attribute.href; + auto handlers = Desktop::Launcher::get_handlers_for_url(attribute.href); if (!handlers.is_empty()) { auto path = URL(attribute.href).path(); auto name = LexicalPath::basename(path); - if (path == handlers[0]) { - m_hovered_href = String::formatted("Execute {}", name); - } else { - m_hovered_href = String::formatted("Open {} with {}", name, LexicalPath::basename(handlers[0])); - } - } else { - m_hovered_href = attribute.href; + if (path == handlers[0]) + set_tooltip(String::formatted("Execute {}", name)); + else + set_tooltip(String::formatted("Open {} with {}", name, LexicalPath::basename(handlers[0]))); } } else { m_hovered_href_id = {}; m_hovered_href = {}; } - set_tooltip(m_hovered_href); show_or_hide_tooltip(); if (!m_hovered_href.is_empty()) set_override_cursor(Gfx::StandardCursor::Arrow); |