summaryrefslogtreecommitdiff
path: root/src/regex_selector.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2011-09-23 09:17:19 +0000
committerMaxime Coste <frrrwww@gmail.com>2011-09-23 09:17:19 +0000
commit662ba0c904530fff306eaafe5fa347fee71ff67a (patch)
treea42843cfe337afe627bbe6c8a22c4c8d6c290870 /src/regex_selector.cc
parent5ca901644f98f88d9fcfd751d8d6ee580de0147d (diff)
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)
Diffstat (limited to 'src/regex_selector.cc')
-rw-r--r--src/regex_selector.cc4
1 files changed, 2 insertions, 2 deletions
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<BufferIterator> 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)
{