summaryrefslogtreecommitdiff
path: root/src/context.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-12-23 01:56:54 +0000
committerMaxime Coste <frrrwww@gmail.com>2015-12-23 01:56:54 +0000
commit411e5a948621ea12d64495c419885f933335e9ec (patch)
tree06f25235fcba358d60520fdbb525a9dd0f8d833d /src/context.hh
parent9e664318af7c33bcc6dd72612294d1d7c982a271 (diff)
Extract jump list handling in a JumpList struct
Diffstat (limited to 'src/context.hh')
-rw-r--r--src/context.hh27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/context.hh b/src/context.hh
index af184663..7ed1442c 100644
--- a/src/context.hh
+++ b/src/context.hh
@@ -50,6 +50,20 @@ private:
bool m_condition;
};
+struct JumpList
+{
+ void push(SelectionList jump);
+ void drop();
+ const SelectionList& forward();
+ const SelectionList& backward(const SelectionList& current);
+ void forget_buffer(Buffer& buffer);
+
+private:
+ using Contents = Vector<SelectionList, MemoryDomain::Selections>;
+ Contents m_jumps;
+ Contents::iterator m_current = m_jumps.begin();
+};
+
// A Context is used to access non singleton objects for various services
// in commands.
//
@@ -113,12 +127,6 @@ public:
StringView main_sel_register_value(StringView reg) const;
- void push_jump();
- void drop_jump();
- const SelectionList& jump_forward();
- const SelectionList& jump_backward();
- void forget_jumps_to_buffer(Buffer& buffer);
-
const String& name() const { return m_name; }
void set_name(String name) { m_name = std::move(name); }
@@ -136,6 +144,9 @@ public:
Flags flags() const { return m_flags; }
+ JumpList& jump_list() { return m_jump_list; }
+ void push_jump() { m_jump_list.push(selections()); }
+
private:
void begin_edition();
void end_edition();
@@ -153,9 +164,7 @@ private:
String m_name;
- using JumpList = Vector<SelectionList>;
- JumpList m_jump_list;
- JumpList::iterator m_current_jump = m_jump_list.begin();
+ JumpList m_jump_list;
NestedBool m_user_hooks_disabled;
NestedBool m_keymaps_disabled;