mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 15:14:44 +00:00
Don't fire fish_prompt when read
is used
Apart from being semantically incorrect, this was causing `fish_prompt` to fire twice after commands that used `read` (e.g. `cdh`). Closes #7039.
This commit is contained in:
parent
e885a65754
commit
2d52335fed
4 changed files with 7 additions and 4 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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.
|
||||
#
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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<bool> 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) {
|
||||
|
|
Loading…
Reference in a new issue