mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-15 22:44:01 +00:00
Migrate initializing CMD_DURATION from reader to env
This puts the initialization of CMD_DURATION at home with other default-initialized variables. No user-visible change expected from this.
This commit is contained in:
parent
4d3261dadc
commit
ec6fd088f2
2 changed files with 5 additions and 7 deletions
|
@ -347,6 +347,11 @@ void env_init(const struct config_paths_t *paths, bool do_uvars, bool default_pa
|
|||
// Set up $IFS - this used to be in share/config.fish, but really breaks if it isn't done.
|
||||
vars.set_one(L"IFS", ENV_GLOBAL, L"\n \t");
|
||||
|
||||
// Ensure this var is present even before an interactive command is run so that if it is used
|
||||
// in a function like `fish_prompt` or `fish_right_prompt` it is defined at the time the first
|
||||
// prompt is written.
|
||||
vars.set_one(L"CMD_DURATION", ENV_UNEXPORT, L"0");
|
||||
|
||||
// Set up the version variable.
|
||||
wcstring version = str2wcstring(get_fish_version());
|
||||
vars.set_one(L"version", ENV_GLOBAL, version);
|
||||
|
|
|
@ -1391,13 +1391,6 @@ void reader_data_t::exec_prompt() {
|
|||
}
|
||||
|
||||
void reader_init() {
|
||||
auto &vars = parser_t::principal_parser().vars();
|
||||
|
||||
// Ensure this var is present even before an interactive command is run so that if it is used
|
||||
// in a function like `fish_prompt` or `fish_right_prompt` it is defined at the time the first
|
||||
// prompt is written.
|
||||
vars.set_one(ENV_CMD_DURATION, ENV_UNEXPORT, L"0");
|
||||
|
||||
// Save the initial terminal mode.
|
||||
tcgetattr(STDIN_FILENO, &terminal_mode_on_startup);
|
||||
|
||||
|
|
Loading…
Reference in a new issue