online help pages updated

This commit is contained in:
Frederic Culot 2008-11-30 20:48:10 +00:00
parent a4694b6bea
commit 86d1a3b2db
3 changed files with 17 additions and 12 deletions

View File

@ -1,3 +1,7 @@
2008-11-29 Frederic Culot <frederic@culot.org>
* src/help.c (help_write_pad): updated to display key bindings
2008-11-26 Frederic Culot <frederic@culot.org> 2008-11-26 Frederic Culot <frederic@culot.org>
* src/help.c (help_screen): updated to display user-defined keys * src/help.c (help_screen): updated to display user-defined keys

View File

@ -1,4 +1,4 @@
/* $calcurse: help.c,v 1.32 2008/11/28 08:46:29 culot Exp $ */ /* $calcurse: help.c,v 1.33 2008/11/30 20:48:10 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -83,19 +83,21 @@ get_help_lines (char *text)
* of lines that were written. * of lines that were written.
*/ */
static int static int
help_write_pad (window_t *win, char *title, char *text) help_write_pad (window_t *win, char *title, char *text, keys_e action)
{ {
int nl_title = 0; int nl_title, nl_text;
int nl_text = 0; const int nl_bindings = 2;
nl_text = get_help_lines (text); nl_text = get_help_lines (text);
nl_title = get_help_lines (title); nl_title = get_help_lines (title);
erase_window_part (win->p, 0, 0, BUFSIZ, win->w); erase_window_part (win->p, 0, 0, BUFSIZ, win->w);
custom_apply_attr (win->p, ATTR_HIGHEST); custom_apply_attr (win->p, ATTR_HIGHEST);
mvwprintw (win->p, 0, 0, "%s", title); mvwprintw (win->p, 0, 0, "%s", title);
mvwprintw (win->p, nl_title, 0, "key bindings: %s",
keys_action_allkeys (action));
custom_remove_attr (win->p, ATTR_HIGHEST); custom_remove_attr (win->p, ATTR_HIGHEST);
mvwprintw (win->p, nl_title, 0, "%s", text); mvwprintw (win->p, nl_title + nl_bindings, 0, "%s", text);
return (nl_text + nl_title); return nl_text + nl_title + nl_bindings;
} }
/* /*
@ -269,7 +271,7 @@ help_screen (void)
{ {
scrollwin_t hwin; scrollwin_t hwin;
int need_resize; int need_resize;
int ch = KEY_GENERIC_HELP; keys_e ch = KEY_GENERIC_HELP;
int page, oldpage; int page, oldpage;
help_page_t hscr[HELPSCREENS]; help_page_t hscr[HELPSCREENS];
@ -652,7 +654,7 @@ help_screen (void)
help_wins_reset (&hwin); help_wins_reset (&hwin);
hwin.first_visible_line = 0; hwin.first_visible_line = 0;
hwin.total_lines = help_write_pad (&hwin.pad, hscr[oldpage].title, hwin.total_lines = help_write_pad (&hwin.pad, hscr[oldpage].title,
hscr[oldpage].text); hscr[oldpage].text, ch);
need_resize = 1; need_resize = 1;
break; break;
@ -670,7 +672,7 @@ help_screen (void)
{ {
hwin.first_visible_line = 0; hwin.first_visible_line = 0;
hwin.total_lines = help_write_pad (&hwin.pad, hscr[page].title, hwin.total_lines = help_write_pad (&hwin.pad, hscr[page].title,
hscr[page].text); hscr[page].text, ch);
oldpage = page; oldpage = page;
} }
break; break;

View File

@ -1,4 +1,4 @@
/* $calcurse: keys.c,v 1.5 2008/11/25 20:48:58 culot Exp $ */ /* $calcurse: keys.c,v 1.6 2008/11/30 20:48:10 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -283,7 +283,7 @@ keys_int2str (int key)
case ESCAPE: case ESCAPE:
return "ESC"; return "ESC";
default: default:
return keyname (key); return (char *)keyname (key);
} }
} }
@ -523,5 +523,4 @@ keys_save_bindings (FILE *fd)
dump_intro (fd); dump_intro (fd);
for (i = 0; i < NBKEYS; i++) for (i = 0; i < NBKEYS; i++)
fprintf (fd, "%s %s\n", keydef[i].label, keys_action_allkeys (i)); fprintf (fd, "%s %s\n", keydef[i].label, keys_action_allkeys (i));
fclose (fd);
} }