summaryrefslogtreecommitdiff
path: root/src/editor.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2013-03-15 18:48:59 +0100
committerMaxime Coste <frrrwww@gmail.com>2013-03-18 19:09:07 +0100
commit354ae7ad89d262c760178e330d66bfc86df977d1 (patch)
treeecff93ae38fdbb97840bd4cabe0c827605ca873d /src/editor.hh
parenta981d41cdefe113876780e4da9718a33a8080393 (diff)
Editor: keep selections sorted and use an index for the main one
Diffstat (limited to 'src/editor.hh')
-rw-r--r--src/editor.hh6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/editor.hh b/src/editor.hh
index a1f27265..6a58eb49 100644
--- a/src/editor.hh
+++ b/src/editor.hh
@@ -73,8 +73,11 @@ public:
void select(SelectionList selections);
void multi_select(const MultiSelector& selector);
+ void rotate_selections(int count) { m_main_sel = (m_main_sel + count) % m_selections.size(); }
+
const SelectionList& selections() const { return m_selections; }
- const Selection& main_selection() const { return m_selections.back(); }
+ const Selection& main_selection() const { return m_selections[m_main_sel]; }
+ size_t main_selection_index() const { return m_main_sel; }
std::vector<String> selections_content() const;
bool undo();
@@ -100,6 +103,7 @@ private:
safe_ptr<Buffer> m_buffer;
DynamicSelectionList m_selections;
+ size_t m_main_sel;
FilterGroup m_filters;
};