diff options
author | huttongrabiel <huttonthomas@icloud.com> | 2022-06-18 12:02:51 -0700 |
---|---|---|
committer | Sam Atkins <atkinssj@gmail.com> | 2022-07-08 11:47:56 +0100 |
commit | 2fbaa7996c9f9fdbfcebf3af95fab88a89de62ac (patch) | |
tree | 082799b85b6dacd387c798328c6e2f754f3670d7 /Userland/Libraries/LibGUI/TextDocument.h | |
parent | 80705a72bde015c824126ea37e55337439b89b76 (diff) | |
download | serenity-2fbaa7996c9f9fdbfcebf3af95fab88a89de62ac.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibGUI/TextDocument.h')
-rw-r--r-- | Userland/Libraries/LibGUI/TextDocument.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/TextDocument.h b/Userland/Libraries/LibGUI/TextDocument.h index dc24141fab..32b28e3292 100644 --- a/Userland/Libraries/LibGUI/TextDocument.h +++ b/Userland/Libraries/LibGUI/TextDocument.h @@ -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; +}; + } |