1
1

prompt: prevent execution of inadmissible functions in view mode

This fixes https://savannah.gnu.org/bugs/?62912.

Bug existed since commit 958ec294 from earlier today,
but was enabled by commit 433dd921 from three days ago.
Этот коммит содержится в:
Benno Schulenberg 2022-08-18 15:49:22 +02:00
родитель 8b4bf2bb8d
Коммит 5a3bd329d6
2 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -367,9 +367,12 @@ int do_statusbar_input(bool *finished)
} }
#endif #endif
else { else {
/* Handle some other shortcut, and indicate that we're done. */ /* Handle any other permissible shortcut, and stamp as done. */
function(); if (!ISSET(VIEW_MODE) || !changes_something(function)) {
*finished = TRUE; function();
*finished = TRUE;
} else
beep();
} }
} }

Просмотреть файл

@ -427,6 +427,7 @@ void terminal_init(void);
void confirm_margin(void); void confirm_margin(void);
#endif #endif
void unbound_key(int code); void unbound_key(int code);
bool changes_something(const void *f);
void inject(char *burst, size_t count); void inject(char *burst, size_t count);
/* Most functions in prompt.c. */ /* Most functions in prompt.c. */