diff options
Diffstat (limited to 'complete.h')
-rw-r--r-- | complete.h | 39 |
1 files changed, 18 insertions, 21 deletions
@@ -14,6 +14,7 @@ #include <wchar.h> +#include <stdint.h> #include "util.h" #include "common.h" @@ -31,7 +32,7 @@ #define NO_COMMON 2 /** * Only use the argument list specifies with completion after - * option. This is the same as (NO_FILES & NO_COMMON) + * option. This is the same as (NO_FILES | NO_COMMON) */ #define EXCLUSIVE 3 @@ -55,13 +56,6 @@ #define COMPLETE_SEP_STR L"\004" /** - * Separator between completion items in fish_pager. This is used for - * completion grouping, e.g. when putting completions with the same - * descriptions on the same line. - */ -#define COMPLETE_ITEM_SEP L'\uf500' - -/** * Character that separates the completion and description on * programmable completions */ @@ -121,13 +115,13 @@ public: The COMPLETE_NO_CASE can be used to signal that this completion is case insensitive. */ - int flags; + complete_flags_t flags; /* Construction. Note: defining these so that they are not inlined reduces the executable size. */ - completion_t(const wcstring &comp, const wcstring &desc = L"", string_fuzzy_match_t match = string_fuzzy_match_t(fuzzy_match_exact), int flags_val = 0); + completion_t(const wcstring &comp, const wcstring &desc = wcstring(), string_fuzzy_match_t match = string_fuzzy_match_t(fuzzy_match_exact), complete_flags_t flags_val = 0); completion_t(const completion_t &); completion_t &operator=(const completion_t &); - + /* Compare two completions. No operating overlaoding to make this always explicit (there's potentially multiple ways to compare completions). */ static bool is_alphabetically_less_than(const completion_t &a, const completion_t &b); static bool is_alphabetically_equal_to(const completion_t &a, const completion_t &b); @@ -142,9 +136,6 @@ enum }; typedef uint32_t completion_request_flags_t; -/** Given a list of completions, returns a list of their completion fields */ -wcstring_list_t completions_to_wcstring_list(const std::vector<completion_t> &completions); - /** Add a completion. @@ -213,17 +204,15 @@ void complete_set_authoritative(const wchar_t *cmd, bool cmd_type, bool authorit void complete_remove(const wchar_t *cmd, bool cmd_is_path, wchar_t short_opt, - const wchar_t *long_opt); + const wchar_t *long_opt, + int long_mode); -/** Find all completions of the command cmd, insert them into out. If to_load is - * not NULL, append all commands that we would autoload, but did not (presumably - * because this is not the main thread) +/** Find all completions of the command cmd, insert them into out. */ void complete(const wcstring &cmd, std::vector<completion_t> &comp, - completion_request_flags_t flags, - wcstring_list_t *to_load = NULL); + completion_request_flags_t flags); /** Print a list of all current completions into the string. @@ -271,9 +260,17 @@ void complete_load(const wcstring &cmd, bool reload); \param flags completion flags */ -void append_completion(std::vector<completion_t> &completions, const wcstring &comp, const wcstring &desc = L"", int flags = 0, string_fuzzy_match_t match = string_fuzzy_match_t(fuzzy_match_exact)); +void append_completion(std::vector<completion_t> &completions, const wcstring &comp, const wcstring &desc = wcstring(), int flags = 0, string_fuzzy_match_t match = string_fuzzy_match_t(fuzzy_match_exact)); /* Function used for testing */ void complete_set_variable_names(const wcstring_list_t *names); +/* Support for "wrap targets." A wrap target is a command that completes liek another command. The target chain is the sequence of wraps (A wraps B wraps C...). Any loops in the chain are silently ignored. */ +bool complete_add_wrapper(const wcstring &command, const wcstring &wrap_target); +bool complete_remove_wrapper(const wcstring &command, const wcstring &wrap_target); +wcstring_list_t complete_get_wrap_chain(const wcstring &command); + +/* Wonky interface: returns all wraps. Even-values are the commands, odd values are the targets. */ +wcstring_list_t complete_get_wrap_pairs(); + #endif |