summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2012-02-27 20:01:59 +0000
committerMaxime Coste <frrrwww@gmail.com>2012-02-27 20:01:59 +0000
commitbc3d20bf2a7d5c36ec69806ce41f8b52fc7730b8 (patch)
tree5fda34a3828bf5a54eb2ac16c84cbfd82e2c1b9e /src
parent5bddd166f10895635e0c2666c3fea5807aaf3302 (diff)
document Selection class
Diffstat (limited to 'src')
-rw-r--r--src/selection.hh11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/selection.hh b/src/selection.hh
index d09a4785..dbc19fc0 100644
--- a/src/selection.hh
+++ b/src/selection.hh
@@ -6,6 +6,12 @@
namespace Kakoune
{
+// A Selection holds a buffer range
+//
+// The Selection class manage a (first, last) buffer iterators pair.
+// Selections are oriented, first may be > last, and inclusive.
+// Selection updates it's iterators according to modifications made
+// in the buffer.
struct Selection : public ModificationListener
{
Selection(const BufferIterator& first, const BufferIterator& last);
@@ -14,7 +20,9 @@ struct Selection : public ModificationListener
Selection& operator=(const Selection& other);
+ // returns min(first, last)
BufferIterator begin() const;
+ // returns max(first, last) + 1
BufferIterator end() const;
const BufferIterator& first() const { return m_first; }
@@ -35,6 +43,9 @@ private:
typedef std::vector<Selection> SelectionList;
typedef std::vector<BufferString> CaptureList;
+// Selections are often associated with a capture list
+// like when they are created from a regex match with
+// capture groups.
struct SelectionAndCaptures
{
Selection selection;