Don't reset the screen after emitting a BEL

Fixes #3693
This commit is contained in:
ridiculousfish 2018-09-16 16:25:49 -07:00
parent f3da54d99c
commit e6863a90c8
3 changed files with 7 additions and 1 deletions

View File

@ -1438,6 +1438,9 @@ static void reader_flash() {
reader_repaint();
ignore_result(write(STDOUT_FILENO, "\a", 1));
// The write above changed the timestamp of stdout; ensure we don't therefore reset our screen.
// See #3693.
s_save_status(&data->screen);
pollint.tv_sec = 0;
pollint.tv_nsec = 100 * 1000000;

View File

@ -352,7 +352,7 @@ static size_t calc_prompt_lines(const wcstring &prompt) {
/// Stat stdout and stderr and save result. This should be done before calling a function that may
/// cause output.
static void s_save_status(screen_t *s) {
void s_save_status(screen_t *s) {
fstat(1, &s->prev_buff_1);
fstat(2, &s->prev_buff_2);
}

View File

@ -181,6 +181,9 @@ void s_write(screen_t *s, const wcstring &left_prompt, const wcstring &right_pro
/// line of garbage for every repaint, which will quickly fill the screen.
void s_reset(screen_t *s, bool reset_cursor, bool reset_prompt = true);
/// Stat stdout and stderr and save result as the current timestamp.
void s_save_status(screen_t *s);
enum screen_reset_mode_t {
/// Do not make a new line, do not repaint the prompt.
screen_reset_current_line_contents,