Code cleanups
This commit is contained in:
parent
3a699c8ac3
commit
7ecd65e1af
|
@ -61,7 +61,7 @@ static CandidateList complete_buffer_name(StringView query, ByteCount cursor_pos
|
||||||
{
|
{
|
||||||
struct RankedMatchAndBuffer : RankedMatch
|
struct RankedMatchAndBuffer : RankedMatch
|
||||||
{
|
{
|
||||||
RankedMatchAndBuffer(const RankedMatch& m, const Buffer* b = nullptr)
|
RankedMatchAndBuffer(const RankedMatch& m, const Buffer* b)
|
||||||
: RankedMatch{m}, buffer{b} {}
|
: RankedMatch{m}, buffer{b} {}
|
||||||
|
|
||||||
using RankedMatch::operator==;
|
using RankedMatch::operator==;
|
||||||
|
|
|
@ -97,7 +97,7 @@ InsertCompletion complete_word(const Buffer& buffer, ByteCoord cursor_pos, const
|
||||||
|
|
||||||
struct RankedMatchAndBuffer : RankedMatch
|
struct RankedMatchAndBuffer : RankedMatch
|
||||||
{
|
{
|
||||||
RankedMatchAndBuffer(const RankedMatch& m, const Buffer* b = nullptr)
|
RankedMatchAndBuffer(const RankedMatch& m, const Buffer* b)
|
||||||
: RankedMatch{m}, buffer{b} {}
|
: RankedMatch{m}, buffer{b} {}
|
||||||
|
|
||||||
using RankedMatch::operator==;
|
using RankedMatch::operator==;
|
||||||
|
@ -130,18 +130,10 @@ InsertCompletion complete_word(const Buffer& buffer, ByteCoord cursor_pos, const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
using StaticWords = Vector<String, MemoryDomain::Options>;
|
||||||
using StaticWords = Vector<String, MemoryDomain::Options>;
|
for (auto& word : options["static_words"].get<StaticWords>())
|
||||||
const StaticWords& static_words = options["static_words"].get<StaticWords>();
|
if (RankedMatch match{word, prefix})
|
||||||
|
matches.emplace_back(match, nullptr);
|
||||||
for (auto& word : static_words)
|
|
||||||
{
|
|
||||||
if (prefix.empty())
|
|
||||||
matches.push_back(RankedMatch{word, prefix});
|
|
||||||
else if (RankedMatch match{word, prefix})
|
|
||||||
matches.push_back(match);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unordered_erase(matches, StringView{prefix});
|
unordered_erase(matches, StringView{prefix});
|
||||||
std::sort(matches.begin(), matches.end());
|
std::sort(matches.begin(), matches.end());
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
namespace Kakoune
|
namespace Kakoune
|
||||||
{
|
{
|
||||||
|
|
||||||
class Value;
|
struct Value;
|
||||||
|
|
||||||
class JsonUI : public UserInterface
|
class JsonUI : public UserInterface
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user