From 662ba0c904530fff306eaafe5fa347fee71ff67a Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 23 Sep 2011 09:17:19 +0000 Subject: Selection: do not use [begin, end) semantics but [first, last] selections are now defined with inclusive iterators, which means that Selection(cursor, cursor) is a valid selection of the charateter pointed by cursor. On the user interface side, that means that the cursor is now part of the selection, selectors were adapted to this behavior (and word selectors are now much more intuitive) --- src/regex_selector.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/regex_selector.cc') diff --git a/src/regex_selector.cc b/src/regex_selector.cc index 07dae533..a8e68bf2 100644 --- a/src/regex_selector.cc +++ b/src/regex_selector.cc @@ -16,9 +16,9 @@ Selection RegexSelector::operator()(const BufferIterator& cursor) const boost::match_results matches; if (boost::regex_search(cursor, cursor.buffer().end(), matches, m_regex, boost::match_nosubs)) - return Selection(matches.begin()->first, matches.begin()->second); + return Selection(matches.begin()->first, matches.begin()->second-1); else if (boost::regex_search(cursor.buffer().begin(), cursor, matches, m_regex, boost::match_nosubs)) - return Selection(matches.begin()->first, matches.begin()->second); + return Selection(matches.begin()->first, matches.begin()->second-1); } catch (boost::regex_error& err) { -- cgit v1.2.3