1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 03:08:13 +00:00

TextEditor: Add UndoCommands for commenting and uncommenting lines

This commit is contained in:
Kyle Lanmon 2022-11-02 23:24:37 -05:00 committed by Andrew Kaster
parent 9aa00a6d70
commit ad250dd484
2 changed files with 98 additions and 0 deletions

View file

@ -288,4 +288,30 @@ private:
TextRange m_range;
};
class CommentSelection : public TextDocumentUndoCommand {
public:
CommentSelection(TextDocument&, StringView, StringView, TextRange const&);
virtual void undo() override;
virtual void redo() override;
TextRange const& range() const { return m_range; }
private:
StringView m_prefix;
StringView m_suffix;
TextRange m_range;
};
class UncommentSelection : public TextDocumentUndoCommand {
public:
UncommentSelection(TextDocument&, StringView, StringView, TextRange const&);
virtual void undo() override;
virtual void redo() override;
TextRange const& range() const { return m_range; }
private:
StringView m_prefix;
StringView m_suffix;
TextRange m_range;
};
}