mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00:00
Fix setting terminal title after fg
The code to override the `(status current-command) was present`, but not handled in either the default `fish_title` function or the fallback. Closes #7444.
This commit is contained in:
parent
9bcfa851c1
commit
a3cb1e2dcd
2 changed files with 12 additions and 8 deletions
|
@ -1,6 +1,8 @@
|
|||
function fish_title
|
||||
# emacs' "term" is basically the only term that can't handle it.
|
||||
if not set -q INSIDE_EMACS; or string match -vq '*,term:*' -- $INSIDE_EMACS
|
||||
echo (status current-command) (__fish_pwd)
|
||||
# An override for the current command is passed as the first parameter.
|
||||
# This is used by `fg` to show the true process name, among others.
|
||||
echo (set -q argv[1] && echo $argv[1] || status current-command) (__fish_pwd)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -103,7 +103,6 @@
|
|||
#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
|
||||
|
@ -1136,15 +1135,18 @@ void reader_write_title(const wcstring &cmd, parser_t &parser, bool reset_cursor
|
|||
scoped_push<bool> noninteractive{&parser.libdata().is_interactive, false};
|
||||
scoped_push<bool> in_title(&parser.libdata().suppress_fish_trace, true);
|
||||
|
||||
wcstring fish_title_command = DEFAULT_TITLE;
|
||||
wcstring fish_title_command = L"echo ";
|
||||
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 */);
|
||||
|
|
Loading…
Reference in a new issue