1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 02:17:34 +00:00

LibGUI: Make class final and seperate from GML Playground

This commit is contained in:
SimonFJ20 2022-04-13 16:15:37 +02:00 committed by Andreas Kling
parent 791e881892
commit 399202f1d3
2 changed files with 6 additions and 4 deletions

View file

@ -884,10 +884,11 @@ void RemoveTextCommand::undo()
m_document.set_all_cursors(new_cursor); 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) : TextDocumentUndoCommand(document)
, m_text(text) , m_text(text)
, m_range(range) , m_range(range)
, m_action_text(action_text)
{ {
} }
@ -916,7 +917,7 @@ bool ReplaceAllTextCommand::merge_with(GUI::Command const&)
String ReplaceAllTextCommand::action_text() 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) TextPosition TextDocument::insert_at(TextPosition const& position, StringView text, Client const* client)

View file

@ -236,10 +236,10 @@ private:
TextRange m_range; TextRange m_range;
}; };
class ReplaceAllTextCommand : public GUI::TextDocumentUndoCommand { class ReplaceAllTextCommand final : public GUI::TextDocumentUndoCommand {
public: 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 redo() override;
void undo() override; void undo() override;
bool merge_with(GUI::Command const&) override; bool merge_with(GUI::Command const&) override;
@ -250,6 +250,7 @@ public:
private: private:
String m_text; String m_text;
GUI::TextRange m_range; GUI::TextRange m_range;
String m_action_text;
}; };
} }