From 8eadf19e97bc18754338fd1a52bc25fc6fe7666f Mon Sep 17 00:00:00 2001 From: Daniel Hammer Date: Mon, 6 Jul 2026 21:21:51 +0200 Subject: [PATCH] fix: confirm copy via the button label instead of status text Instead of a separate "Copied to clipboard" line beside the Copy button, flip the button's own label to "Copied" for ~1.6s after a copy, then back to "Copy". Simpler and keeps the footer uncluttered. Co-Authored-By: Claude Opus 4.8 --- programs/src/charmap/main.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/programs/src/charmap/main.cpp b/programs/src/charmap/main.cpp index e0dd57c..9973a04 100644 --- a/programs/src/charmap/main.cpp +++ b/programs/src/charmap/main.cpp @@ -209,7 +209,6 @@ static constexpr int CELL_SIZE = 26; // glyph font size inside a tile static constexpr int PREVIEW_SIZE = 40; static constexpr int NAME_SIZE = 16; static constexpr int META_SIZE = 14; -static constexpr int STATUS_SIZE = 14; static constexpr uint64_t COPIED_MS = 1600; @@ -421,20 +420,12 @@ static void render(Canvas& c) { draw_text(c, fonts::system_font, text_x, L.footer.y + 16 + NAME_SIZE + 8, meta, g_theme.text_subtle, META_SIZE); - // Transient "copied" confirmation: a plain status line just left of the - // Copy button (no floating overlay over the grid). - if (g_copied_until && montauk::get_milliseconds() < g_copied_until) { - const char* msg = "Copied to clipboard"; - int sw = text_width(fonts::system_font, msg, STATUS_SIZE); - int sh = text_height(fonts::system_font, STATUS_SIZE); - draw_text(c, fonts::system_font, L.copy_btn.x - 14 - sw, - L.copy_btn.y + (L.copy_btn.h - sh) / 2, - msg, g_theme.accent, STATUS_SIZE); - } - // Copy button — canonical MTK primary button, like other Montauk apps. + // Its label flips to "Copied" for a moment after a copy as confirmation. + bool just_copied = g_copied_until && montauk::get_milliseconds() < g_copied_until; mtk::WidgetState copy_state = mtk::widget_state(false, g_copy_hover, true); - mtk::draw_button(c, L.copy_btn, "Copy", mtk::BUTTON_PRIMARY, copy_state, g_theme); + mtk::draw_button(c, L.copy_btn, just_copied ? "Copied" : "Copy", + mtk::BUTTON_PRIMARY, copy_state, g_theme); } // ==== Event handling ====