[genius] Wed Mar 28 15:57:41 2012 Jiri (George) Lebl <jirka 5z com>



commit f4a19c1b31d1812fd755b69fed6d37c99857e973
Author: Jiri (George) Lebl <jirka 5z com>
Date:   Wed Mar 28 15:57:44 2012 -0500

    Wed Mar 28 15:57:41 2012  Jiri (George) Lebl <jirka 5z com>
    
    	* src/calc.c: when running help and things are not documented and not
    	  defined, don't output three lines saying so, just the one error will
    	  do.

 ChangeLog  |    6 ++++++
 src/calc.c |   19 +++++++++++++++----
 2 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index af6c9d1..ca54f71 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Mar 28 15:57:41 2012  Jiri (George) Lebl <jirka 5z com>
+
+	* src/calc.c: when running help and things are not documented and not
+	  defined, don't output three lines saying so, just the one error will
+	  do.
+
 Tue Mar 27 22:56:49 2012  Jiri (George) Lebl <jirka 5z com>
 
 	* Release 1.0.15
diff --git a/src/calc.c b/src/calc.c
index 80b4f40..1cbeac7 100644
--- a/src/calc.c
+++ b/src/calc.c
@@ -2726,6 +2726,7 @@ gel_help_on (const char *text)
 				   NULL /* help_html */ };
 	GelEFunc *f;
 	int i;
+	gboolean documented_or_func_or_param = TRUE;
 
 	gel_output_push_nonotify (gel_main_out);
 
@@ -2762,10 +2763,18 @@ gel_help_on (const char *text)
 		return;
 	}
 
-	do_cyan ();
 
 	f = d_lookup_global (d_intern (text));
 
+	if (f == NULL &&
+	    help == &not_documented &&
+	    ! d_intern (text)->parameter) {
+		documented_or_func_or_param = FALSE;
+	}
+
+	if (documented_or_func_or_param)
+		do_cyan ();
+
 	if (d_intern (text)->parameter) {
 		gel_output_printf_full (gel_main_out, FALSE, "%s%s\n",
 					_("Parameter: "), text);
@@ -2773,7 +2782,8 @@ gel_help_on (const char *text)
 		   || (f->type == GEL_BUILTIN_FUNC &&
 		       f->named_args == NULL &&
 		       ! f->vararg)) {
-		gel_output_printf_full (gel_main_out, FALSE, "%s\n", text);
+		if (documented_or_func_or_param)
+			gel_output_printf_full (gel_main_out, FALSE, "%s\n", text);
 	} else {
 		GSList *li;
 		gel_output_printf_full (gel_main_out, FALSE, "%s (", text);
@@ -2789,7 +2799,8 @@ gel_help_on (const char *text)
 			gel_output_full_string (gel_main_out, "...");
 		gel_output_full_string (gel_main_out, ")\n");
 	}
-	do_green ();
+	if (documented_or_func_or_param)
+		do_green ();
 
 	if (help->aliases != NULL) {
 		GSList *li;
@@ -2803,7 +2814,7 @@ gel_help_on (const char *text)
 		g_string_free (gs, TRUE);
 	}
 
-	if (help->description != NULL) {
+	if (documented_or_func_or_param && help->description != NULL) {
 		gel_output_printf_full (gel_main_out, FALSE,
 					_("Description: %s\n"),
 					_(help->description));



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