From 6b6f8d2295051fa26baccc84b584748682756ea3 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 28 Feb 2021 08:40:39 +0100 Subject: [PATCH] Avoid changing how custom fish_titles are called This half-reverts commit a3cb1e2dcd5bc13520c29f61ca615cf5e140db96, avoiding the bit that passed arguments differently. Note that this means the initial bug is kept in the hardcoded fallback title. Fixes #7749. --- src/reader.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/reader.cpp b/src/reader.cpp index e64f4c550..c7b0c3204 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -102,6 +102,9 @@ /// The name of the function for getting the input mode indicator. #define MODE_PROMPT_FUNCTION_NAME L"fish_mode_prompt" +/// The default title for the reader. This is used by reader_readline. +#define DEFAULT_TITLE L"echo (status current-command) \" \" $PWD" + /// The maximum number of characters to read from the keyboard without repainting. Note that this /// readahead will only occur if new characters are available for reading, fish will never block for /// more input without repainting. @@ -1214,18 +1217,15 @@ void reader_write_title(const wcstring &cmd, parser_t &parser, bool reset_cursor scoped_push noninteractive{&parser.libdata().is_interactive, false}; scoped_push in_title(&parser.libdata().suppress_fish_trace, true); - wcstring fish_title_command = L"echo "; + wcstring fish_title_command = DEFAULT_TITLE; if (function_exists(L"fish_title", parser)) { fish_title_command = L"fish_title"; + if (!cmd.empty()) { + fish_title_command.append(L" "); + fish_title_command.append( + escape_string(cmd, ESCAPE_ALL | ESCAPE_NO_QUOTED | ESCAPE_NO_TILDE)); + } } - if (!cmd.empty()) { - fish_title_command.append(L" "); - fish_title_command.append( - escape_string(cmd, ESCAPE_ALL | ESCAPE_NO_QUOTED | ESCAPE_NO_TILDE)); - } else { - fish_title_command.append(L" (status current-command)"); - } - fish_title_command.append(L" $PWD"); wcstring_list_t lst; (void)exec_subshell(fish_title_command, parser, lst, false /* ignore exit status */);