Move get_word_db to word_db.cc

This commit is contained in:
Maxime Coste 2018-04-15 13:21:57 +10:00
parent e207bd30d4
commit f545ff7727
3 changed files with 11 additions and 9 deletions

View File

@ -79,15 +79,6 @@ void option_from_string(StringView str, InsertCompleterDesc& opt)
namespace
{
WordDB& get_word_db(const Buffer& buffer)
{
static const ValueId word_db_id = get_free_value_id();
Value& cache_val = buffer.values()[word_db_id];
if (not cache_val)
cache_val = Value(WordDB{buffer});
return cache_val.as<WordDB>();
}
template<bool other_buffers>
InsertCompletion complete_word(const SelectionList& sels,
const OptionManager& options,

View File

@ -10,6 +10,15 @@ namespace Kakoune
using WordList = Vector<StringView>;
WordDB& get_word_db(const Buffer& buffer)
{
static const ValueId word_db_id = get_free_value_id();
Value& cache_val = buffer.values()[word_db_id];
if (not cache_val)
cache_val = Value(WordDB{buffer});
return cache_val.as<WordDB>();
}
static WordList get_words(StringView content, ConstArrayView<Codepoint> extra_word_chars)
{
WordList res;

View File

@ -48,6 +48,8 @@ private:
Lines m_lines;
};
WordDB& get_word_db(const Buffer& buffer);
}
#endif // word_db_hh_INCLUDED