1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:27:46 +00:00

LibGUI: Indent selected text on tab press

If selected text is less than a whole line, usual delete/replace takes
place. Otherwise, if the selected text is a whole line or spans
multiple lines, the selection will be indented.
This commit is contained in:
huttongrabiel 2022-06-18 12:02:51 -07:00 committed by Sam Atkins
parent 80705a72bd
commit 2fbaa7996c
4 changed files with 80 additions and 2 deletions

View file

@ -259,4 +259,16 @@ private:
String m_action_text;
};
class IndentSelection : public TextDocumentUndoCommand {
public:
IndentSelection(TextDocument&, size_t tab_width, TextRange const&);
virtual void undo() override;
virtual void redo() override;
TextRange const& range() const { return m_range; }
private:
size_t m_tab_width { 0 };
TextRange m_range;
};
}