summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-03-14 13:38:46 +0000
committerMaxime Coste <frrrwww@gmail.com>2016-03-14 13:41:20 +0000
commit7ecd65e1afc2ab193c01211a5feb6f97fa305d25 (patch)
tree171e5d90ff4afae38240fdcac6a0d76efc42b878 /src
parent3a699c8ac38b7bf22c586ef06312f2360a054f86 (diff)
Code cleanups
Diffstat (limited to 'src')
-rw-r--r--src/commands.cc2
-rw-r--r--src/insert_completer.cc18
-rw-r--r--src/json_ui.hh2
3 files changed, 7 insertions, 15 deletions
diff --git a/src/commands.cc b/src/commands.cc
index b376f081..8eb676ba 100644
--- a/src/commands.cc
+++ b/src/commands.cc
@@ -61,7 +61,7 @@ static CandidateList complete_buffer_name(StringView query, ByteCount cursor_pos
{
struct RankedMatchAndBuffer : RankedMatch
{
- RankedMatchAndBuffer(const RankedMatch& m, const Buffer* b = nullptr)
+ RankedMatchAndBuffer(const RankedMatch& m, const Buffer* b)
: RankedMatch{m}, buffer{b} {}
using RankedMatch::operator==;
diff --git a/src/insert_completer.cc b/src/insert_completer.cc
index c33673e6..5fa34c72 100644
--- a/src/insert_completer.cc
+++ b/src/insert_completer.cc
@@ -97,7 +97,7 @@ InsertCompletion complete_word(const Buffer& buffer, ByteCoord cursor_pos, const
struct RankedMatchAndBuffer : RankedMatch
{
- RankedMatchAndBuffer(const RankedMatch& m, const Buffer* b = nullptr)
+ RankedMatchAndBuffer(const RankedMatch& m, const Buffer* b)
: RankedMatch{m}, buffer{b} {}
using RankedMatch::operator==;
@@ -130,18 +130,10 @@ InsertCompletion complete_word(const Buffer& buffer, ByteCoord cursor_pos, const
}
}
- {
- using StaticWords = Vector<String, MemoryDomain::Options>;
- const StaticWords& static_words = options["static_words"].get<StaticWords>();
-
- for (auto& word : static_words)
- {
- if (prefix.empty())
- matches.push_back(RankedMatch{word, prefix});
- else if (RankedMatch match{word, prefix})
- matches.push_back(match);
- }
- }
+ using StaticWords = Vector<String, MemoryDomain::Options>;
+ for (auto& word : options["static_words"].get<StaticWords>())
+ if (RankedMatch match{word, prefix})
+ matches.emplace_back(match, nullptr);
unordered_erase(matches, StringView{prefix});
std::sort(matches.begin(), matches.end());
diff --git a/src/json_ui.hh b/src/json_ui.hh
index 563ff997..3ebbafbb 100644
--- a/src/json_ui.hh
+++ b/src/json_ui.hh
@@ -8,7 +8,7 @@
namespace Kakoune
{
-class Value;
+struct Value;
class JsonUI : public UserInterface
{