diff options
| author | Maxime Coste <mawww@kakoune.org> | 2025-04-02 17:35:23 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2025-04-02 17:35:23 +1100 |
| commit | 63efcc06d5bee7f05a1ee9539b2391c80e5d6205 (patch) | |
| tree | 8ad15a23836f02421ff98796b7a2c994fe00165d /src/insert_completer.cc | |
| parent | c7d688f578c7b58989fc04e7bb1e9b5a939a5730 (diff) | |
Tweak ranked match behaviour to consider the number of full words
Tracking the number of query words that appear as full words in the
candidate seems to fix a few cases where the existing fuzzy matching
algorithm was not great.
I have been running with this for a while and did not notice any
annoyances, the whole RankedMatch code probably deserves more attention
but this seems to go in the right direction.
Diffstat (limited to 'src/insert_completer.cc')
| -rw-r--r-- | src/insert_completer.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/insert_completer.cc b/src/insert_completer.cc index 49bbd4ca..01058012 100644 --- a/src/insert_completer.cc +++ b/src/insert_completer.cc @@ -3,7 +3,6 @@ #include "buffer_manager.hh" #include "buffer_utils.hh" #include "debug.hh" -#include "client.hh" #include "command_manager.hh" #include "changes.hh" #include "context.hh" @@ -13,6 +12,7 @@ #include "regex.hh" #include "window.hh" #include "word_db.hh" +#include "word_splitter.hh" #include "option_types.hh" #include "utf8_iterator.hh" #include "user_interface.hh" @@ -87,7 +87,7 @@ InsertCompletion complete_word(const SelectionList& sels, for (int i = 0; i < sels.size(); ++i) { int len = 0; - auto is_short_enough_word = [&] (Codepoint c) { return len++ < WordDB::max_word_len && is_word_pred(c); }; + auto is_short_enough_word = [&] (Codepoint c) { return len++ < WordSplitter::max_word_len && is_word_pred(c); }; Utf8It end{buffer.iterator_at(sels[i].cursor()), buffer}; Utf8It begin = end-1; @@ -103,7 +103,7 @@ InsertCompletion complete_word(const SelectionList& sels, skip_while(end, buffer.end(), is_short_enough_word); - if (len <= WordDB::max_word_len) + if (len <= WordSplitter::max_word_len) { StringView word = buffer.substr(begin.base().coord(), end.base().coord()); ++sel_word_counts[word]; |
