This patch builds on the prior history setting patch, but I figured it
might be of the most questionable necessity. This adds the ":clear"
command for clearing history. I noticed that the commands processed
from the rc file ended up in the command history, and thought this
should not be the case. That's debatable, but this allows clearing the
history either as the last command in the rc file or manually any
other time.

Morgan
From eb9170b858c378150f88ba6e3bb435bb50a9f75a Mon Sep 17 00:00:00 2001
From: Morgan Howe <[email protected]>
Date: Fri, 26 Dec 2014 22:38:57 +0800
Subject: [PATCH 2/2] Add the clear command for deleting command history.

---
 config.h      | 1 +
 utilities.c   | 6 ++++++
 utilities.h   | 1 +
 vimprobable.h | 2 +-
 4 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/config.h b/config.h
index 5f44fa3..a28d642 100644
--- a/config.h
+++ b/config.h
@@ -132,6 +132,7 @@ Command commands[COMMANDSIZE] = {
     /* command,                                        	function,         argument */
     { "ba",                                            	navigate,         {NavigationBack} },
     { "back",                                          	navigate,         {NavigationBack} },
+    { "clear",                                         	clear,            {0} },
     { "ec",                                            	script,           {Info} },
     { "echo",                                          	script,           {Info} },
     { "echoe",                                         	script,           {Error} },
diff --git a/utilities.c b/utilities.c
index a72cfa6..12f076a 100644
--- a/utilities.c
+++ b/utilities.c
@@ -54,6 +54,12 @@ void save_command_history(char *line)
     }
 }
 
+gboolean clear(const Arg *arg)
+{
+    clear_history(0);
+    return TRUE;
+}
+
 void set_command_history_len(int len)
 {
     command_histsize = len;
diff --git a/utilities.h b/utilities.h
index ccfdb45..a2ee5f6 100644
--- a/utilities.h
+++ b/utilities.h
@@ -12,6 +12,7 @@
 
 enum ConfigFileError read_rcfile(const char *config);
 void save_command_history(char *line);
+gboolean clear(const Arg *arg);
 void set_command_history_len(int len);
 gboolean process_save_qmark(const char *bm, WebKitWebView *webview);
 void make_keyslist(void);
diff --git a/vimprobable.h b/vimprobable.h
index 9f55055..5f6ee83 100644
--- a/vimprobable.h
+++ b/vimprobable.h
@@ -193,7 +193,7 @@ enum ConfigFileError {
 #define             CLOSED_URL_FILENAME         "%s/vimprobable/closed", client.config.config_base
 
 /* Command size */
-#define	            COMMANDSIZE	                48
+#define	            COMMANDSIZE	                49
 
 /* maximum size of internal string variable handled by :set
  * if you set this to anything lower than 8, colour values
-- 
1.9.1

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
Vimprobable-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vimprobable-users

Reply via email to