commit 6cd53e7f4461de24e9d489ebf72a91ec70f9f908
parent b84d7bf7a5b3390a44e5de1bb12db21c64748499
Author: Liu Hao <lh_mouse@126.com>
Date: Tue, 11 Sep 2018 14:57:17 +0800
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>
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git 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)