diff options
| author | Maxime Coste <mawww@kakoune.org> | 2018-04-15 13:21:57 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2018-04-19 07:58:42 +1000 |
| commit | f545ff7727966cba62c0912bb66d032b668e7813 (patch) | |
| tree | c3fbf10af523af3023933ff7fee4abf1e89d65d0 /src/word_db.cc | |
| parent | e207bd30d4007c9031bd639f8232adc8dc4dce25 (diff) | |
Move get_word_db to word_db.cc
Diffstat (limited to 'src/word_db.cc')
| -rw-r--r-- | src/word_db.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/word_db.cc b/src/word_db.cc index a5d59e4c..c9bd226a 100644 --- a/src/word_db.cc +++ b/src/word_db.cc @@ -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; |
