summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2013-03-09 13:30:10 +0100
committerMaxime Coste <frrrwww@gmail.com>2013-03-11 14:20:28 +0100
commit8cc9a44d47a729d2a22317ab5fb3432fcabd4861 (patch)
tree37779306a1dd0aa5b92da96416c9188883feb198 /src/input_handler.cc
parenteab2cc240aa58b508a799a779fb90f29460ebe25 (diff)
minor cleanups in complete_word
Diffstat (limited to 'src/input_handler.cc')
-rw-r--r--src/input_handler.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc
index e7653152..6dc3f17a 100644
--- a/src/input_handler.cc
+++ b/src/input_handler.cc
@@ -463,14 +463,12 @@ static std::pair<CandidateList, BufferIterator> complete_word(const BufferIterat
++begin;
const Buffer& buffer = pos.buffer();
- String prefix = buffer.string(begin, end);
- String ex = "\\<\\Q" + prefix + "\\E\\w+\\>";
+ String ex = R"(\<\Q)" + buffer.string(begin, end) + R"(\E\w+\>)";
Regex re(ex.begin(), ex.end());
- boost::regex_iterator<BufferIterator> it(buffer.begin(), buffer.end(), re);
- boost::regex_iterator<BufferIterator> re_end;
+ using RegexIt = boost::regex_iterator<BufferIterator>;
CandidateList result;
- for (; it != re_end; ++it)
+ for (RegexIt it(buffer.begin(), buffer.end(), re), re_end; it != re_end; ++it)
{
auto& match = (*it)[0];
if (match.first <= pos and pos < match.second)
@@ -481,7 +479,7 @@ static std::pair<CandidateList, BufferIterator> complete_word(const BufferIterat
result.emplace_back(std::move(content));
}
std::sort(result.begin(), result.end());
- return { result, begin };
+ return { std::move(result), begin };
}
class BufferCompleter