From 47df1374fe4a8ed5575ae607c654bbf68988ebb4 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 17 Feb 2016 23:40:14 +0000 Subject: Refactor use selection as search pattern implementation --- src/buffer_utils.hh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/buffer_utils.hh') 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(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}) -- cgit v1.2.3