From 08f5064ef7b204d3c564f76b1c2e78d83d586a1a Mon Sep 17 00:00:00 2001
From: Lukas Fleischer <calcurse@cryptocrack.de>
Date: Wed, 17 Jul 2013 01:03:05 +0200
Subject: Add introduction to the new online help system

This adds a very basic explanation of the new help command that can be
displayed using ":help intro". This introduction is also added as
default page so that users can simply type ":help" instead.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
---
 doc/Makefile.am |  1 +
 doc/intro.txt   | 15 +++++++++++++++
 src/calcurse.c  |  3 +++
 3 files changed, 19 insertions(+)
 create mode 100644 doc/intro.txt

diff --git a/doc/Makefile.am b/doc/Makefile.am
index 8c74706..6c549c9 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -29,6 +29,7 @@ dist_doc_DATA = \
 	general.txt \
 	goto.txt \
 	import.txt \
+	intro.txt \
 	main.txt \
 	manual.txt \
 	other.txt \
diff --git a/doc/intro.txt b/doc/intro.txt
new file mode 100644
index 0000000..a841739
--- /dev/null
+++ b/doc/intro.txt
@@ -0,0 +1,15 @@
+calcurse Online Help
+====================
+
+Welcome to the calcurse online help. The online help system allows for easily
+getting help on specific calcurse features.
+
+On the calcurse main screen, type `:help <feature>` (e.g. `:help add`) to get
+help on a specific feature. Type `:help` without any parameter to display this
+introduction or simply use the corresponding keyboard shortcut (`?` by
+default).
+
+All help texts are displayed using an external pager. You need to exit the
+pager in order to get back to calcurse (pressing `q` should almost always
+work). The default pager can be changed by setting the PAGER environment
+variable.
diff --git a/src/calcurse.c b/src/calcurse.c
index d20e9d0..859bc1e 100644
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -503,6 +503,9 @@ static inline void key_generic_cmd(void)
 		char *topic = strtok(NULL, " ");
 		char path[BUFSIZ];
 
+		if (!topic)
+			topic = "intro";
+
 		snprintf(path, BUFSIZ, DOCDIR "/%s.txt", topic);
 		if (io_file_exist(path)) {
 			wins_launch_external(path, conf.pager);
-- 
cgit v1.2.3-70-g09d2