summaryrefslogtreecommitdiff
path: root/src/selection.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-09-22 20:36:26 +0100
committerMaxime Coste <frrrwww@gmail.com>2016-10-01 13:45:00 +0100
commit35559b65ddf107fea2a4dda92fcbd664986976d9 (patch)
tree58840b2523abb01459afb09ad2480df07b9ddd2d /src/selection.hh
parent6e17ecfb6eadc157cc5229f3c36f2962cfe1fcdf (diff)
Support codepoints of variable width
Add a ColumnCount type and use it in place of CharCount whenever more appropriate, take column size of codepoints into account for vertical movements and docstring wrapping. Fixes #811
Diffstat (limited to 'src/selection.hh')
-rw-r--r--src/selection.hh24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/selection.hh b/src/selection.hh
index 29c3ffdc..7428fb39 100644
--- a/src/selection.hh
+++ b/src/selection.hh
@@ -14,19 +14,19 @@ struct Selection
static constexpr MemoryDomain Domain = MemoryDomain::Selections;
Selection() = default;
- Selection(ByteCoord pos) : Selection(pos,pos) {}
- Selection(ByteCoord anchor, ByteCoord cursor,
+ Selection(BufferCoord pos) : Selection(pos,pos) {}
+ Selection(BufferCoord anchor, BufferCoord cursor,
CaptureList captures = {})
: m_anchor{anchor}, m_cursor{cursor},
m_captures(std::move(captures)) {}
void merge_with(const Selection& range);
- ByteCoord& anchor() { return m_anchor; }
- ByteCoordAndTarget& cursor() { return m_cursor; }
+ BufferCoord& anchor() { return m_anchor; }
+ BufferCoordAndTarget& cursor() { return m_cursor; }
- const ByteCoord& anchor() const { return m_anchor; }
- const ByteCoordAndTarget& cursor() const { return m_cursor; }
+ const BufferCoord& anchor() const { return m_anchor; }
+ const BufferCoordAndTarget& cursor() const { return m_cursor; }
CaptureList& captures() { return m_captures; }
const CaptureList& captures() const { return m_captures; }
@@ -36,15 +36,15 @@ struct Selection
return m_anchor == other.m_anchor and m_cursor == other.m_cursor;
}
- const ByteCoord& min() const { return m_anchor < m_cursor ? m_anchor : m_cursor; }
- const ByteCoord& max() const { return m_anchor < m_cursor ? m_cursor : m_anchor; }
+ const BufferCoord& min() const { return m_anchor < m_cursor ? m_anchor : m_cursor; }
+ const BufferCoord& max() const { return m_anchor < m_cursor ? m_cursor : m_anchor; }
- ByteCoord& min() { return m_anchor < m_cursor ? m_anchor : m_cursor; }
- ByteCoord& max() { return m_anchor < m_cursor ? m_cursor : m_anchor; }
+ BufferCoord& min() { return m_anchor < m_cursor ? m_anchor : m_cursor; }
+ BufferCoord& max() { return m_anchor < m_cursor ? m_cursor : m_anchor; }
private:
- ByteCoord m_anchor;
- ByteCoordAndTarget m_cursor;
+ BufferCoord m_anchor;
+ BufferCoordAndTarget m_cursor;
CaptureList m_captures;
};