mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 21:58:12 +00:00
LibGUI: Make undo work for TextDocument ReplaceAllTextCommand
The undo code here was just replacing the new text with the new text. Now we actually save the old text and use that instead. :^)
This commit is contained in:
parent
7164b2f758
commit
a5ff6769f5
2 changed files with 8 additions and 6 deletions
|
@ -270,17 +270,18 @@ private:
|
|||
class ReplaceAllTextCommand final : public GUI::TextDocumentUndoCommand {
|
||||
|
||||
public:
|
||||
ReplaceAllTextCommand(GUI::TextDocument& document, DeprecatedString const& text, GUI::TextRange const& range, DeprecatedString const& action_text);
|
||||
ReplaceAllTextCommand(GUI::TextDocument& document, DeprecatedString const& new_text, GUI::TextRange const& range, DeprecatedString const& action_text);
|
||||
virtual ~ReplaceAllTextCommand() = default;
|
||||
void redo() override;
|
||||
void undo() override;
|
||||
bool merge_with(GUI::Command const&) override;
|
||||
DeprecatedString action_text() const override;
|
||||
DeprecatedString const& text() const { return m_text; }
|
||||
DeprecatedString const& text() const { return m_new_text; }
|
||||
TextRange const& range() const { return m_range; }
|
||||
|
||||
private:
|
||||
DeprecatedString m_text;
|
||||
DeprecatedString m_original_text;
|
||||
DeprecatedString m_new_text;
|
||||
GUI::TextRange m_range;
|
||||
DeprecatedString m_action_text;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue