diff --git a/CHANGELOG.md b/CHANGELOG.md index dddc5f7b3..d8f9d409a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - The history file is now created with user-private permissions, matching other shells (#6926). The directory containing the history file remains private, so there should not have been any private date revealed. - fish no longer disables flow control after every command. Enterprising users can now enable it for external commands with `stty`. (#2315) - Added a `fish_job_summary` function which is called whenever a background job stops or ends, or any job terminates from a signal. The default behaviour can now be customized by redefining this function. +- The `fish_prompt` event no longer fires when `read` is used. If you need a function to run any time `read` is invoked by a script, use the new `fish_read` event instead. ### Syntax changes and new commands diff --git a/share/config.fish b/share/config.fish index 56324d686..185a59ade 100644 --- a/share/config.fish +++ b/share/config.fish @@ -141,7 +141,7 @@ function fish_sigtrap_handler --on-signal TRAP --no-scope-shadowing --descriptio end # -# Whenever a prompt is displayed, make sure that interactive +# When a prompt is first displayed, make sure that interactive # mode-specific initializations have been performed. # This handler removes itself after it is first called. # diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index c2d6cd31f..d53bd0935 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -218,10 +218,12 @@ function __fish_config_interactive -d "Initializations that should be performed # Load key bindings __fish_reload_key_bindings + # Enable bracketed paste exception when running unit tests so we don't have to add + # the sequences to bind.expect if not set -q FISH_UNIT_TESTS_RUNNING # Enable bracketed paste before every prompt (see __fish_shared_bindings for the bindings). - # Disable it for unit tests so we don't have to add the sequences to bind.expect - function __fish_enable_bracketed_paste --on-event fish_prompt + # Enable bracketed paste when the read builtin is used. + function __fish_enable_bracketed_paste --on-event fish_prompt --on-event fish_read printf "\e[?2004h" end diff --git a/src/builtin_read.cpp b/src/builtin_read.cpp index 2a60890ce..d925fc7dc 100644 --- a/src/builtin_read.cpp +++ b/src/builtin_read.cpp @@ -221,7 +221,7 @@ static int read_interactive(parser_t &parser, wcstring &buff, int nchars, bool s reader_set_buffer(commandline, std::wcslen(commandline)); scoped_push interactive{&parser.libdata().is_interactive, true}; - event_fire_generic(parser, L"fish_prompt"); + event_fire_generic(parser, L"fish_read"); auto mline = reader_readline(nchars); interactive.restore(); if (mline) {