mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:27:35 +00:00
LibGUI: Add shortcut for inserting new line
This adds shortcut for inserting a new empty indented line above/below current cursor position. - <Ctrl-Return> for inserting line below. - <Ctrl-Shift-Return> for inserting line above.
This commit is contained in:
parent
e06f9174a1
commit
2f8c7b1b30
3 changed files with 81 additions and 0 deletions
|
@ -246,6 +246,27 @@ private:
|
|||
TextRange m_range;
|
||||
};
|
||||
|
||||
class InsertLineCommand : public TextDocumentUndoCommand {
|
||||
public:
|
||||
enum class InsertPosition {
|
||||
Above,
|
||||
Below,
|
||||
};
|
||||
|
||||
InsertLineCommand(TextDocument&, TextPosition, DeprecatedString&&, InsertPosition);
|
||||
virtual ~InsertLineCommand() = default;
|
||||
virtual void undo() override;
|
||||
virtual void redo() override;
|
||||
virtual DeprecatedString action_text() const override;
|
||||
|
||||
private:
|
||||
size_t compute_line_number() const;
|
||||
|
||||
TextPosition m_cursor;
|
||||
DeprecatedString m_text;
|
||||
InsertPosition m_pos;
|
||||
};
|
||||
|
||||
class ReplaceAllTextCommand final : public GUI::TextDocumentUndoCommand {
|
||||
|
||||
public:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue