mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
add command line string as $argv[1] for fish_title
This commit is contained in:
parent
556680cf5e
commit
87abcecca6
3 changed files with 13 additions and 6 deletions
|
@ -3251,7 +3251,7 @@ static int builtin_fg(parser_t &parser, wchar_t **argv)
|
||||||
const wcstring ft = tok_first(j->command_wcstr());
|
const wcstring ft = tok_first(j->command_wcstr());
|
||||||
if (! ft.empty())
|
if (! ft.empty())
|
||||||
env_set(L"_", ft.c_str(), ENV_EXPORT);
|
env_set(L"_", ft.c_str(), ENV_EXPORT);
|
||||||
reader_write_title();
|
reader_write_title(j->command_wcstr());
|
||||||
|
|
||||||
make_first(j);
|
make_first(j);
|
||||||
job_set_flag(j, JOB_FOREGROUND, 1);
|
job_set_flag(j, JOB_FOREGROUND, 1);
|
||||||
|
|
13
reader.cpp
13
reader.cpp
|
@ -902,7 +902,7 @@ bool reader_thread_job_is_stale()
|
||||||
return (void*)(uintptr_t) s_generation_count != pthread_getspecific(generation_count_key);
|
return (void*)(uintptr_t) s_generation_count != pthread_getspecific(generation_count_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void reader_write_title()
|
void reader_write_title(const wchar_t *cmd)
|
||||||
{
|
{
|
||||||
const wchar_t *title;
|
const wchar_t *title;
|
||||||
const env_var_t term_str = env_get_string(L"TERM");
|
const env_var_t term_str = env_get_string(L"TERM");
|
||||||
|
@ -946,7 +946,12 @@ void reader_write_title()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
title = function_exists(L"fish_title")?L"fish_title":DEFAULT_TITLE;
|
wcstring fish_title = L"fish_title";
|
||||||
|
if (cmd) {
|
||||||
|
fish_title.append(L" ");
|
||||||
|
fish_title.append(parse_util_escape_string_with_quote(cmd, L'\0'));
|
||||||
|
}
|
||||||
|
title = function_exists(L"fish_title")?fish_title.c_str():DEFAULT_TITLE;
|
||||||
|
|
||||||
if (wcslen(title) ==0)
|
if (wcslen(title) ==0)
|
||||||
return;
|
return;
|
||||||
|
@ -1015,7 +1020,7 @@ static void exec_prompt()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the screen title */
|
/* Write the screen title */
|
||||||
reader_write_title();
|
reader_write_title(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void reader_init()
|
void reader_init()
|
||||||
|
@ -2535,7 +2540,7 @@ void reader_run_command(parser_t &parser, const wcstring &cmd)
|
||||||
if (! ft.empty())
|
if (! ft.empty())
|
||||||
env_set(L"_", ft.c_str(), ENV_GLOBAL);
|
env_set(L"_", ft.c_str(), ENV_GLOBAL);
|
||||||
|
|
||||||
reader_write_title();
|
reader_write_title(cmd.c_str());
|
||||||
|
|
||||||
term_donate();
|
term_donate();
|
||||||
|
|
||||||
|
|
4
reader.h
4
reader.h
|
@ -116,8 +116,10 @@ void reader_pop_current_filename();
|
||||||
Write the title to the titlebar. This function is called just
|
Write the title to the titlebar. This function is called just
|
||||||
before a new application starts executing and just after it
|
before a new application starts executing and just after it
|
||||||
finishes.
|
finishes.
|
||||||
|
|
||||||
|
\param cmd Command line string passed to \c fish_title if is defined.
|
||||||
*/
|
*/
|
||||||
void reader_write_title();
|
void reader_write_title(const wchar_t *cmd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Call this function to tell the reader that a repaint is needed, and
|
Call this function to tell the reader that a repaint is needed, and
|
||||||
|
|
Loading…
Reference in a new issue