[bugs] Allow using :x instead of :wq

Hi,

This is a simple bug fix for Calcurse.

In Vim, the :x command is the same* as :wq, and while Calcurse implements :wq, it doesn't recognize :x and an 'unrecognized command' error message pops up if :x is used.

This patch just makes :x the same as :wq.

Thanks,
Sub Raizada


* :x in Vim only writes out the current buffer if it has been changed, whereas :wq always writes, but making it an alias for :wq should be 'good enough' here.
From 6c85d3a17ff26cfbf1952bbd6f5687546579dbd7 Mon Sep 17 00:00:00 2001
From: Subramaniyam Raizada <sub@xxxxxxxxxxxxxx>
Date: Sun, 21 Oct 2018 01:17:17 -0400
Subject: [PATCH] allow using :x instead of :wq

---
 src/calcurse.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/calcurse.c b/src/calcurse.c
index 8e1978e..7c3ff4f 100644
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -489,12 +489,12 @@ static inline void key_generic_cmd(void)
 	}
 
 	if (!strcmp(cmd_name, "write") || !strcmp(cmd_name, "w") ||
-	    !strcmp(cmd_name, "wq")) {
+	    !strcmp(cmd_name, "wq")    || !strcmp(cmd_name, "x")) {
 		io_save_cal(IO_SAVE_DISPLAY_BAR);
 		valid = 1;
 	}
 	if (!strcmp(cmd_name, "quit") || !strcmp(cmd_name, "q") ||
-	    !strcmp(cmd_name, "wq")) {
+	    !strcmp(cmd_name, "wq")   || !strcmp(cmd_name, "x")) {
 		if (force || !conf.confirm_quit || status_ask_bool(
 				_("Do you really want to quit?")) == 1)
 			exit_calcurse(EXIT_SUCCESS);
-- 
2.19.1

Links