From b119b4f1daf5c78eadc4097f7a4e14892939e491 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Wed, 13 Feb 2013 13:22:29 -0800 Subject: [PATCH] Fix to look up fish_pager in __fish_bin_dir instead of by using PATH, in preparation for making fish no longer need to modify PATH --- reader.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/reader.cpp b/reader.cpp index 223b3c603..b05234254 100644 --- a/reader.cpp +++ b/reader.cpp @@ -1097,6 +1097,23 @@ static void completion_insert(const wchar_t *val, complete_flags_t flags) data->suppress_autosuggestion = true; } +/* Return an escaped path to fish_pager */ +static wcstring escaped_fish_pager_path(void) +{ + wcstring result; + const env_var_t bin_dir = env_get_string(L"__fish_bin_dir"); + if (bin_dir.missing_or_empty()) + { + /* This isn't good, hope our normal command stuff can find it */ + result = L"fish_pager"; + } + else + { + result = escape_string(bin_dir + L"/fish_pager", ESCAPE_ALL); + } + return result; +} + /** Run the fish_pager command to display the completion list. If the fish_pager outputs any text, it is inserted into the input @@ -1106,7 +1123,6 @@ static void completion_insert(const wchar_t *val, complete_flags_t flags) \param is_quoted should be set if the argument is quoted. This will change the display style. \param comp the list of completions to display */ - static void run_pager(const wcstring &prefix, int is_quoted, const std::vector &comp) { wcstring msg; @@ -1131,9 +1147,12 @@ static void run_pager(const wcstring &prefix, int is_quoted, const std::vector