From 2d938cdcdaa470d521f048d3b29e7a8a97612785 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Thu, 13 Jan 2011 23:21:40 +0000 Subject: Avoid a segfault when resizing the help window. --- ChangeLog | 5 +++++ src/help.c | 56 +++++++++++++++++++++++++++++--------------------------- 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3b37b4b..ccadb78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-01-14 Lukas Fleischer + + * src/help.c: Avoid a segfault when resizing the help window + (resizing still needs to be fixed properly). + 2011-01-11 Lukas Fleischer * AUTHORS diff --git a/src/help.c b/src/help.c index 81bcc99..e2b171c 100644 --- a/src/help.c +++ b/src/help.c @@ -1,4 +1,4 @@ -/* $calcurse: help.c,v 1.45 2011/01/11 22:31:40 fleischer Exp $ */ +/* $calcurse: help.c,v 1.46 2011/01/13 23:21:40 fleischer Exp $ */ /* * Calcurse - text-based organizer @@ -109,32 +109,34 @@ help_write_pad (struct window *win, char *title, char *text, enum key action) erase_window_part (win->p, rownum, colnum, BUFSIZ, win->w); custom_apply_attr (win->p, ATTR_HIGHEST); mvwprintw (win->p, rownum, colnum, "%s", title); - switch (action) - { - case KEY_END_OF_WEEK: - case KEY_START_OF_WEEK: - case KEY_MOVE_UP: - case KEY_MOVE_DOWN: - case KEY_MOVE_RIGHT: - case KEY_MOVE_LEFT: - case KEY_GENERIC_HELP: - case KEY_GENERIC_REDRAW: - case KEY_GENERIC_ADD_APPT: - case KEY_GENERIC_ADD_TODO: - case KEY_GENERIC_NEXT_DAY: - case KEY_GENERIC_PREV_DAY: - case KEY_GENERIC_NEXT_WEEK: - case KEY_GENERIC_PREV_WEEK: - case KEY_GENERIC_GOTO_TODAY: - case KEY_GENERIC_CREDITS: - case KEY_GENERIC_CUT: - case KEY_GENERIC_PASTE: - break; - default: - bindings = keys_action_allkeys (action); - colnum = win->w - strlen (bindings_title) - strlen (bindings); - mvwprintw (win->p, rownum, colnum, bindings_title, bindings); - } + if ((int) action != KEY_RESIZE) { + switch (action) + { + case KEY_END_OF_WEEK: + case KEY_START_OF_WEEK: + case KEY_MOVE_UP: + case KEY_MOVE_DOWN: + case KEY_MOVE_RIGHT: + case KEY_MOVE_LEFT: + case KEY_GENERIC_HELP: + case KEY_GENERIC_REDRAW: + case KEY_GENERIC_ADD_APPT: + case KEY_GENERIC_ADD_TODO: + case KEY_GENERIC_NEXT_DAY: + case KEY_GENERIC_PREV_DAY: + case KEY_GENERIC_NEXT_WEEK: + case KEY_GENERIC_PREV_WEEK: + case KEY_GENERIC_GOTO_TODAY: + case KEY_GENERIC_CREDITS: + case KEY_GENERIC_CUT: + case KEY_GENERIC_PASTE: + break; + default: + bindings = keys_action_allkeys (action); + colnum = win->w - strlen (bindings_title) - strlen (bindings); + mvwprintw (win->p, rownum, colnum, bindings_title, bindings); + } + } colnum = 0; rownum += get_help_lines (title); custom_remove_attr (win->p, ATTR_HIGHEST); -- cgit v1.2.3-70-g09d2