search: disallow switching to the Replace prompt when in view mode

Switching to Replace allows modifiying the buffer, which should
not be possible in view mode.

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

Bug existed since version 2.9.4, commit 54103d8e.

Signed-off-by: Liu Hao <lh_mouse@126.com>
master
Liu Hao 2018-09-11 14:57:17 +08:00 committed by Benno Schulenberg
parent b84d7bf7a5
commit 6cd53e7f44
1 changed files with 6 additions and 0 deletions

View File

@ -155,6 +155,12 @@ void search_init(bool replacing, bool keep_the_answer)
} else if (func == regexp_void) {
TOGGLE(USE_REGEXP);
} else if (func == flip_replace) {
if (ISSET(VIEW_MODE)) {
print_view_warning();
tidy_up_after_search();
free(thedefault);
return;
}
replacing = !replacing;
} else {
if (func == flip_goto)