From 6cd53e7f4461de24e9d489ebf72a91ec70f9f908 Mon Sep 17 00:00:00 2001 From: Liu Hao Date: Tue, 11 Sep 2018 14:57:17 +0800 Subject: [PATCH] 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 --- src/search.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/search.c b/src/search.c index 86b9fe45..18f8880a 100644 --- a/src/search.c +++ b/src/search.c @@ -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)