nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nano-devel] [PATCH 2/2] src/search.c: Disallow toggle from Search to Re


From: Liu Hao
Subject: [Nano-devel] [PATCH 2/2] src/search.c: Disallow toggle from Search to Replace in view mode.
Date: Tue, 11 Sep 2018 14:57:17 +0800 (CST)

Toggling to Replace prompt would allow modification in view mode
and should be disallowed.

Signed-off-by: Liu Hao <address@hidden>
---
  src/search.c | 6 ++++++
  1 file changed, 6 insertions(+)

diff --git a/src/search.c b/src/search.c
index 038606f5..781d1f7e 100644
--- a/src/search.c
+++ b/src/search.c
@@ -162,6 +162,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)
-- 
2.17.1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]