From a50cb5f6e7969183c69b56578ad63cb61fe06227 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 3 Dec 2022 16:50:29 +0100 Subject: Share logic for undo/redo selection changes I will suggest a few changes to this code. No functional change. --- src/context.hh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/context.hh') diff --git a/src/context.hh b/src/context.hh index 5ef3c42c..cf7b7a67 100644 --- a/src/context.hh +++ b/src/context.hh @@ -19,6 +19,8 @@ class DisplayLine; class KeymapManager; class AliasRegistry; +enum Direction { Backward = -1, Forward = 1 }; + struct JumpList { void push(SelectionList jump, Optional index = {}); @@ -91,8 +93,8 @@ public: SelectionList& selections_write_only(); void end_selection_edition() { m_selection_history.end_edition(); } + template void undo_selection_change(); - void redo_selection_change(); void change_buffer(Buffer& buffer, Optional> set_selection = {}); void forget_buffer(Buffer& buffer); @@ -170,8 +172,8 @@ private: void end_edition(); bool in_edition() const { return m_in_edition; } + template void undo(); - void redo(); void forget_buffer(Buffer& buffer); private: enum class HistoryId : size_t { First = 0, Invalid = (size_t)-1 }; -- cgit v1.2.3