From 2fbaa7996c9f9fdbfcebf3af95fab88a89de62ac Mon Sep 17 00:00:00 2001 From: huttongrabiel Date: Sat, 18 Jun 2022 12:02:51 -0700 Subject: 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. --- Userland/Libraries/LibGUI/TextDocument.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'Userland/Libraries/LibGUI/TextDocument.h') 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; +}; + } -- cgit v1.2.3