summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2012-12-27 13:41:45 +0100
committerMaxime Coste <frrrwww@gmail.com>2012-12-27 13:41:45 +0100
commitac778c8aa2c5431a2df08048704639023830c636 (patch)
treee6279844dd881c1308ba0d4c3b597bc00a184642 /src
parentf3a7c76c4e859001211772c7e370d559491ccffa (diff)
select_matching: fix when matching is the first character
Diffstat (limited to 'src')
-rw-r--r--src/selectors.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/selectors.cc b/src/selectors.cc
index 02d80135..84f5ab98 100644
--- a/src/selectors.cc
+++ b/src/selectors.cc
@@ -205,12 +205,14 @@ Selection select_matching(const Selection& selection)
int level = 0;
const Codepoint opening = *(match-1);
const Codepoint closing = *match;
- while (not is_begin(it))
+ while (true)
{
if (*it == closing)
++level;
else if (*it == opening and --level == 0)
return utf8_selection(begin, it);
+ if (is_begin(it))
+ break;
--it;
}
}