From ac778c8aa2c5431a2df08048704639023830c636 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 27 Dec 2012 13:41:45 +0100 Subject: [PATCH] select_matching: fix when matching is the first character --- src/selectors.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; } }