1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:57:35 +00:00

LibGUI: Fix wrong cursor position after undoing RemoveTextCommand

When you undo some forward delete shortcuts like <Del> or <Ctrl-Del>,
the cursor will be put at the end of the text deleted, while the right
position should be the start of those text.
This commit is contained in:
Xuekun Li 2023-05-18 16:43:46 +08:00 committed by Jelle Raaijmakers
parent b78622ddf7
commit 200a4a00dd
3 changed files with 19 additions and 17 deletions

View file

@ -254,7 +254,7 @@ private:
class RemoveTextCommand : public TextDocumentUndoCommand {
public:
RemoveTextCommand(TextDocument&, DeprecatedString const&, TextRange const&);
RemoveTextCommand(TextDocument&, DeprecatedString const&, TextRange const&, TextPosition const&);
virtual ~RemoveTextCommand() = default;
virtual void undo() override;
virtual void redo() override;
@ -265,6 +265,7 @@ public:
private:
DeprecatedString m_text;
TextRange m_range;
TextPosition m_original_cursor_position;
};
class InsertLineCommand : public TextDocumentUndoCommand {