nano-devel
[Top][All Lists]
Advanced

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

[Nano-devel] [PATCH 2/2] bindings: make ^Q and ^S do something useful by


From: Benno Schulenberg
Subject: [Nano-devel] [PATCH 2/2] bindings: make ^Q and ^S do something useful by default
Date: Sun, 24 Sep 2017 21:02:08 +0200

^S will be the first thing people will try for saving a file,
and ^Q is somewhat mnemonic because it is to the left of ^W.
But people who expect ^Q to quit the program might be annoyed
as this new binding makes it even "harder" to get out of nano.
---
 src/global.c |  6 ++++--
 src/nano.c   | 11 -----------
 src/proto.h  |  2 --
 3 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/src/global.c b/src/global.c
index 2926403b..00beb463 100644
--- a/src/global.c
+++ b/src/global.c
@@ -1258,8 +1258,10 @@ void shortcut_init(void)
     add_to_sclist(MMAIN, "M-Z", 0, do_toggle_void, SUSPEND);
 #endif /* !NANO_TINY */
 
-    add_to_sclist(MMAIN, "^Q", 0, xon_complaint, 0);
-    add_to_sclist(MMAIN, "^S", 0, xoff_complaint, 0);
+    if (!ISSET(PRESERVE)) {
+       add_to_sclist(MMAIN, "^Q", 0, do_search_backward, 0);
+       add_to_sclist(MMAIN, "^S", 0, do_savefile, 0);
+    }
 
     add_to_sclist(((MMOST & ~MMAIN & ~MBROWSER) | MYESNO), "^C", 0, do_cancel, 
0);
 
diff --git a/src/nano.c b/src/nano.c
index fec3a9a8..574739e6 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1731,17 +1731,6 @@ int do_input(bool allow_funcs)
     return input;
 }
 
-void xon_complaint(void)
-{
-    statusbar(_("XON ignored, mumble mumble"));
-}
-
-void xoff_complaint(void)
-{
-    statusbar(_("XOFF ignored, mumble mumble"));
-}
-
-
 #ifdef ENABLE_MOUSE
 /* Handle a mouse click on the edit window or the shortcut list. */
 int do_mouse(void)
diff --git a/src/proto.h b/src/proto.h
index 41ad640c..e8789abf 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -691,8 +691,6 @@ void spotlight(bool active, size_t from_col, size_t to_col);
 #ifndef NANO_TINY
 void spotlight_softwrapped(bool active, size_t from_col, size_t to_col);
 #endif
-void xon_complaint(void);
-void xoff_complaint(void);
 void do_suspend_void(void);
 void disable_waiting(void);
 void enable_waiting(void);
-- 
2.14.1




reply via email to

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