mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-26 03:35:17 +00:00
Prevent fish_title output from triggering a bel
fish outputs the result of fish_title inside an escape sequence, which happens to be terminated by \a (BEL). It may happen that the initial output is interrupted; fish then emits the closing BEL and that makes an annoying beep. Output the fish_title all at once, even if a signal is delivered (so we don't get "stuck inside" the sequence). This is related to #8628 in that it's a "torn escape sequence."
This commit is contained in:
parent
1bdd629326
commit
7f31acbf9b
1 changed files with 5 additions and 3 deletions
|
@ -1293,11 +1293,13 @@ void reader_write_title(const wcstring &cmd, parser_t &parser, bool reset_cursor
|
||||||
wcstring_list_t lst;
|
wcstring_list_t lst;
|
||||||
(void)exec_subshell(fish_title_command, parser, lst, false /* ignore exit status */);
|
(void)exec_subshell(fish_title_command, parser, lst, false /* ignore exit status */);
|
||||||
if (!lst.empty()) {
|
if (!lst.empty()) {
|
||||||
std::fputws(L"\x1B]0;", stdout);
|
wcstring title_line = L"\x1B]0;";
|
||||||
for (const auto &i : lst) {
|
for (const auto &i : lst) {
|
||||||
std::fputws(i.c_str(), stdout);
|
title_line += i;
|
||||||
}
|
}
|
||||||
ignore_result(write(STDOUT_FILENO, "\a", 1));
|
title_line += L"\a";
|
||||||
|
std::string narrow = wcs2string(title_line);
|
||||||
|
ignore_result(write_loop(STDOUT_FILENO, narrow.data(), narrow.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
outputter_t::stdoutput().set_color(rgb_color_t::reset(), rgb_color_t::reset());
|
outputter_t::stdoutput().set_color(rgb_color_t::reset(), rgb_color_t::reset());
|
||||||
|
|
Loading…
Reference in a new issue