From 281805696bba168defa0cce79ad15673727ec032 Mon Sep 17 00:00:00 2001 From: thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> Date: Mon, 29 Nov 2021 09:52:56 -0500 Subject: [PATCH] FontEditor: Don't allow cutting and copying absent glyphs And update status bar on cut. Fixes placing these effectless actions on the undo stack. --- Userland/Applications/FontEditor/FontEditor.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Userland/Applications/FontEditor/FontEditor.cpp b/Userland/Applications/FontEditor/FontEditor.cpp index d20d4daf15..9e1def20ad 100644 --- a/Userland/Applications/FontEditor/FontEditor.cpp +++ b/Userland/Applications/FontEditor/FontEditor.cpp @@ -177,9 +177,18 @@ FontEditorWidget::FontEditorWidget() save_as(save_path.value()); }); m_cut_action = GUI::CommonActions::make_cut_action([&](auto&) { + if (!m_edited_font->contains_raw_glyph(m_glyph_map_widget->selected_glyph())) + return; m_glyph_editor_widget->cut_glyph(); + if (m_edited_font->is_fixed_width()) + m_glyph_editor_present_checkbox->set_checked(false, GUI::AllowCallback::No); + else + m_glyph_editor_width_spinbox->set_value(0, GUI::AllowCallback::No); + update_statusbar(); }); m_copy_action = GUI::CommonActions::make_copy_action([&](auto&) { + if (!m_edited_font->contains_raw_glyph(m_glyph_map_widget->selected_glyph())) + return; m_glyph_editor_widget->copy_glyph(); }); m_paste_action = GUI::CommonActions::make_paste_action([&](auto&) {