diff --git a/Userland/Libraries/LibGUI/TextDocument.cpp b/Userland/Libraries/LibGUI/TextDocument.cpp index 71bdf853bd..2d8e15cd40 100644 --- a/Userland/Libraries/LibGUI/TextDocument.cpp +++ b/Userland/Libraries/LibGUI/TextDocument.cpp @@ -884,10 +884,11 @@ void RemoveTextCommand::undo() m_document.set_all_cursors(new_cursor); } -ReplaceAllTextCommand::ReplaceAllTextCommand(GUI::TextDocument& document, String const& text, GUI::TextRange const& range) +ReplaceAllTextCommand::ReplaceAllTextCommand(GUI::TextDocument& document, String const& text, GUI::TextRange const& range, String const& action_text) : TextDocumentUndoCommand(document) , m_text(text) , m_range(range) + , m_action_text(action_text) { } @@ -916,7 +917,7 @@ bool ReplaceAllTextCommand::merge_with(GUI::Command const&) String ReplaceAllTextCommand::action_text() const { - return "Playground format text"; + return m_action_text; } TextPosition TextDocument::insert_at(TextPosition const& position, StringView text, Client const* client) diff --git a/Userland/Libraries/LibGUI/TextDocument.h b/Userland/Libraries/LibGUI/TextDocument.h index 48f569cac9..c024c85090 100644 --- a/Userland/Libraries/LibGUI/TextDocument.h +++ b/Userland/Libraries/LibGUI/TextDocument.h @@ -236,10 +236,10 @@ private: TextRange m_range; }; -class ReplaceAllTextCommand : public GUI::TextDocumentUndoCommand { +class ReplaceAllTextCommand final : public GUI::TextDocumentUndoCommand { public: - ReplaceAllTextCommand(GUI::TextDocument& document, String const& text, GUI::TextRange const& range); + ReplaceAllTextCommand(GUI::TextDocument& document, String const& text, GUI::TextRange const& range, String const& action_text); void redo() override; void undo() override; bool merge_with(GUI::Command const&) override; @@ -250,6 +250,7 @@ public: private: String m_text; GUI::TextRange m_range; + String m_action_text; }; }