summaryrefslogtreecommitdiff
path: root/src/buffer_utils.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-02-17 23:40:14 +0000
committerMaxime Coste <frrrwww@gmail.com>2016-02-17 23:40:14 +0000
commit47df1374fe4a8ed5575ae607c654bbf68988ebb4 (patch)
tree237542cc432f31bd07074246af2d83aae4cdf813 /src/buffer_utils.hh
parent85a8a0c26d68c1cba203810aaa5cd42e635112cb (diff)
Refactor use selection as search pattern implementation
Diffstat (limited to 'src/buffer_utils.hh')
-rw-r--r--src/buffer_utils.hh9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/buffer_utils.hh b/src/buffer_utils.hh
index 8e7fe5dc..543e2357 100644
--- a/src/buffer_utils.hh
+++ b/src/buffer_utils.hh
@@ -37,6 +37,15 @@ inline bool is_eol(const Buffer& buffer, ByteCoord coord)
return buffer.is_end(coord) or buffer[coord.line].length() == coord.column+1;
}
+inline bool is_bow(const Buffer& buffer, ByteCoord coord)
+{
+ auto it = utf8::iterator<BufferIterator>(buffer.iterator_at(coord), buffer);
+ if (coord == ByteCoord{0,0})
+ return is_word(*it);
+
+ return not is_word(*(it-1)) and is_word(*it);
+}
+
inline bool is_eow(const Buffer& buffer, ByteCoord coord)
{
if (buffer.is_end(coord) or coord == ByteCoord{0,0})