diff --git a/Userland/Libraries/LibGUI/GlyphMapWidget.cpp b/Userland/Libraries/LibGUI/GlyphMapWidget.cpp index a4d1acd49c0..f3399cfe14c 100644 --- a/Userland/Libraries/LibGUI/GlyphMapWidget.cpp +++ b/Userland/Libraries/LibGUI/GlyphMapWidget.cpp @@ -247,6 +247,17 @@ void GlyphMapWidget::mouseup_event(GUI::MouseEvent& event) void GlyphMapWidget::mousemove_event(GUI::MouseEvent& event) { m_last_mousemove_position = event.position(); + if (auto maybe_glyph = glyph_at_position(event.position()); maybe_glyph.has_value() && maybe_glyph != m_tooltip_glyph) { + m_tooltip_glyph = maybe_glyph.value(); + auto draw_tooltip = [this]() -> ErrorOr { + StringBuilder builder; + TRY(builder.try_appendff("U+{:04X}", m_tooltip_glyph)); + set_tooltip(TRY(builder.to_string())); + return {}; + }(); + if (draw_tooltip.is_error()) + warnln("Failed to draw tooltip"); + } if (m_in_drag_select) { auto constrained = event.position().constrained(widget_inner_rect()); auto glyph = glyph_at_position_clamped(constrained); diff --git a/Userland/Libraries/LibGUI/GlyphMapWidget.h b/Userland/Libraries/LibGUI/GlyphMapWidget.h index f90bbfea1b4..62b30f38a63 100644 --- a/Userland/Libraries/LibGUI/GlyphMapWidget.h +++ b/Userland/Libraries/LibGUI/GlyphMapWidget.h @@ -111,6 +111,7 @@ private: int m_vertical_spacing { 4 }; Selection m_selection; int m_active_glyph { 0 }; + int m_tooltip_glyph { 0 }; int m_visible_glyphs { 0 }; bool m_in_drag_select { false }; bool m_highlight_modifications { false };