diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-12-27 13:41:45 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-12-27 13:41:45 +0100 |
| commit | ac778c8aa2c5431a2df08048704639023830c636 (patch) | |
| tree | e6279844dd881c1308ba0d4c3b597bc00a184642 /src | |
| parent | f3a7c76c4e859001211772c7e370d559491ccffa (diff) | |
select_matching: fix when matching is the first character
Diffstat (limited to 'src')
| -rw-r--r-- | src/selectors.cc | 4 |
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; } } |
