aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2006-08-30 17:46:02 +0000
committerFrederic Culot <calcurse@culot.org>2006-08-30 17:46:02 +0000
commit11a7ed0c7b14b8e88f6713cabc6ecb8dcb1aae96 (patch)
tree6ec25fe60e9e22c3ae351758d6471b4c4c0a83ed
parentfa0822c6c3be91ee1068bab5e43539c86943e82c (diff)
downloadcalcurse-11a7ed0c7b14b8e88f6713cabc6ecb8dcb1aae96.tar.gz
calcurse-11a7ed0c7b14b8e88f6713cabc6ecb8dcb1aae96.zip
bugfix: pressing 'R' while no item was selected caused a segfault. Thanks to Chris for reporting it.
add_todo() moved to todo_new_item() in todo.c
-rwxr-xr-xsrc/calcurse.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/src/calcurse.c b/src/calcurse.c
index 1133bcd..bf40821 100755
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -1,4 +1,4 @@
-/* $calcurse: calcurse.c,v 1.7 2006/08/24 20:13:22 culot Exp $ */
+/* $calcurse: calcurse.c,v 1.8 2006/08/30 17:46:02 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -97,7 +97,6 @@ void get_date(void);
void init_vars(int colr);
void init_wins(void), reinit_wins(void);
void add_item(void);
-void add_todo(void);
void load_conf(void);
bool fill_config_var(char *string);
void update_todo_panel(void);
@@ -304,7 +303,9 @@ int main(int argc, char **argv)
add_item();
do_storage = true;
} else if (which_pan == TODO) {
- add_todo();
+ nb_tod = todo_new_item(nb_tod, colr);
+ if (hilt_tod == 0 && nb_tod == 1)
+ hilt_tod++;
}
break;
@@ -316,7 +317,7 @@ int main(int argc, char **argv)
case 'R':
case 'r':
- if (which_pan == APPOINTMENT)
+ if (which_pan == APPOINTMENT && hilt_app != 0)
recur_repeat_item(sel_year, sel_month,
sel_day, hilt_app, colr);
break;
@@ -855,24 +856,6 @@ void del_item(void)
}
}
- /* Add an item in the ToDo list */
-void add_todo(void)
-{
- char *mesg = _("Enter the new ToDo item : ");
- char todo_input[500];
-
- status_mesg(mesg, "");
- getstring(swin, colr, todo_input, 0, 1);
- if (strlen(todo_input) != 0) {
- todo_insert(todo_input);
- ++nb_tod;
- update_todo_panel();
- }
- erase_window_part(swin, 0, 0, nc_bar, nl_bar);
- status_bar(which_pan, colr, nc_bar, nl_bar);
- doupdate();
-}
-
/*
* Add an item in either the appointment or the event list,
* depending if the start time is entered or not.