diff options
| author | Maxime Coste <mawww@kakoune.org> | 2025-02-19 22:03:56 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2025-02-19 23:02:03 +1100 |
| commit | f910d6cb657ff39df5c536929e4146f88acda93f (patch) | |
| tree | 451adb66d06cbb2353f0536febb01c048e6f4f24 /src/completion.hh | |
| parent | eb7d34333b0698e8e1a8af4f2be908ab08cb2089 (diff) | |
Move command/filename completion logic to completion.cc
Refactor list_files to use a callback instead of returning a vector,
file.cc/hh should not know about completion logic.
Diffstat (limited to 'src/completion.hh')
| -rw-r--r-- | src/completion.hh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/completion.hh b/src/completion.hh index cef703a2..0f13e9bf 100644 --- a/src/completion.hh +++ b/src/completion.hh @@ -12,6 +12,7 @@ namespace Kakoune { class Context; +class Regex; using CandidateList = Vector<String, MemoryDomain::Completion>; @@ -47,6 +48,20 @@ inline Completions complete_nothing(const Context&, StringView, ByteCount cursor return {cursor_pos, cursor_pos}; } +enum class FilenameFlags +{ + None = 0, + OnlyDirectories = 1 << 0, + Expand = 1 << 1 +}; +constexpr bool with_bit_ops(Meta::Type<FilenameFlags>) { return true; } + +CandidateList complete_filename(StringView prefix, const Regex& ignore_regex, + ByteCount cursor_pos = -1, + FilenameFlags flags = FilenameFlags::None); + +CandidateList complete_command(StringView prefix, ByteCount cursor_pos = -1); + Completions shell_complete(const Context& context, StringView, ByteCount cursor_pos); inline Completions offset_pos(Completions completion, ByteCount offset) |
