summaryrefslogtreecommitdiff
path: root/src/coord.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/coord.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/coord.hh')
-rw-r--r--src/coord.hh22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/coord.hh b/src/coord.hh
index 2a55695a..aa2f0e54 100644
--- a/src/coord.hh
+++ b/src/coord.hh
@@ -91,36 +91,36 @@ struct LineAndColumn
}
};
-struct ByteCoord : LineAndColumn<ByteCoord, LineCount, ByteCount>
+struct BufferCoord : LineAndColumn<BufferCoord, LineCount, ByteCount>
{
[[gnu::always_inline]]
- constexpr ByteCoord(LineCount line = 0, ByteCount column = 0)
+ constexpr BufferCoord(LineCount line = 0, ByteCount column = 0)
: LineAndColumn(line, column) {}
};
-struct CharCoord : LineAndColumn<CharCoord, LineCount, CharCount>
+struct DisplayCoord : LineAndColumn<DisplayCoord, LineCount, ColumnCount>
{
[[gnu::always_inline]]
- constexpr CharCoord(LineCount line = 0, CharCount column = 0)
+ constexpr DisplayCoord(LineCount line = 0, ColumnCount column = 0)
: LineAndColumn(line, column) {}
static constexpr const char* option_type_name = "coord";
};
-struct ByteCoordAndTarget : ByteCoord
+struct BufferCoordAndTarget : BufferCoord
{
[[gnu::always_inline]]
- constexpr ByteCoordAndTarget(LineCount line = 0, ByteCount column = 0, CharCount target = -1)
- : ByteCoord(line, column), target(target) {}
+ constexpr BufferCoordAndTarget(LineCount line = 0, ByteCount column = 0, ColumnCount target = -1)
+ : BufferCoord(line, column), target(target) {}
[[gnu::always_inline]]
- constexpr ByteCoordAndTarget(ByteCoord coord, CharCount target = -1)
- : ByteCoord(coord), target(target) {}
+ constexpr BufferCoordAndTarget(BufferCoord coord, ColumnCount target = -1)
+ : BufferCoord(coord), target(target) {}
- CharCount target;
+ ColumnCount target;
};
-inline size_t hash_value(const ByteCoordAndTarget& val)
+inline size_t hash_value(const BufferCoordAndTarget& val)
{
return hash_values(val.line, val.column, val.target);
}