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:
parent
9aa00a6d70
commit
ad250dd484
2 changed files with 98 additions and 0 deletions
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue