summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcinzelent <marcin@zelent.net>2017-08-01 17:43:32 +0200
committermarcinzelent <marcin@zelent.net>2017-08-01 17:43:32 +0200
commite561eedea2344ccbfe35d609220911488abe34bb (patch)
treeef51033ad280f4bc7b7a53a89555b41fc88dd5e1
parente99a6affae723cd4735f7504f892739508e9345b (diff)
Fixed overflow of activities descriptions.
-rw-r--r--timetracker.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/timetracker.c b/timetracker.c
index dc9a922..e0ebe74 100644
--- a/timetracker.c
+++ b/timetracker.c
@@ -83,7 +83,7 @@ void print_new_activity(WINDOW *win)
strftime(start_time, sizeof(start_time), "%H:%M:%S", localtime(&new_activity.start_time));
- mvwprintw(win, 1, 1, "Current activity: %s", new_activity.description);
+ mvwprintw(win, 1, 1, "Current activity: %.*s", COLS-20, new_activity.description);
mvwprintw(win, 2, 1, "Start time: %s", start_time);
mvwprintw(win, 3, 1, "Duration: %ld", (time_now - new_activity.start_time)/60);
@@ -102,7 +102,7 @@ void print_activities(WINDOW *win)
mvwprintw(win, 4 * i + 1, 1, "Start time: %s", start_time);
mvwprintw(win, 4 * i + 2, 1, "End time: %s", end_time);
- mvwprintw(win, 4 * i + 3, 1, "Activity: %s", activities_list[i].description);
+ mvwprintw(win, 4 * i + 3, 1, "Activity: %.*s", COLS-13, activities_list[i].description);
}
wrefresh(win);