diff options
author | Antony Kellermann | 2018-05-30 22:04:59 -0400 |
---|---|---|
committer | Antony Kellermann | 2018-05-30 22:04:59 -0400 |
commit | 7b7f25c75e47464a5b66a99795f272d0455d43cb (patch) | |
tree | dcaabae586e56f86b73b7b00b747b266340865fa /info.c | |
parent | 89e1ac2e2c7fd4ba7ea10d68233547e206bb44db (diff) | |
download | aur-7b7f25c75e47464a5b66a99795f272d0455d43cb.tar.gz |
Fixed graph zooming past current date bug
Diffstat (limited to 'info.c')
-rw-r--r-- | info.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -263,13 +263,6 @@ void graph_printw(WINDOW* window, Info* symbol_info, Info* symbol_info2) { if (zoom == ZOOM_1m) start_date.tm_mon += 1; // Moves only one month if zoom is 1 month else start_date.tm_mon += zoom_change_x_months[zoom]; - - end = start_date; // If trying to go past current date, set start to (zoom level - current date) - end.tm_mon += zoom_months[zoom]; - if (difftime(mktime(&end), mktime(&today_date)) > 0) { - start_date = today_date; - start_date.tm_mon -= zoom_months[zoom]; - } } else { // LEFT if (zoom == ZOOM_1m) start_date.tm_mon -= 1; // Moves only one month if zoom is 1 month @@ -277,6 +270,12 @@ void graph_printw(WINDOW* window, Info* symbol_info, Info* symbol_info2) { if (difftime(mktime(&start_date), mktime(&furthest_back_date)) < 0) start_date = furthest_back_date; // Can't go back past furthest_date } + end = start_date; // If trying to go past current date, set start to (zoom level - current date) + end.tm_mon += zoom_months[zoom]; + if (difftime(mktime(&end), mktime(&today_date)) > 0) { + start_date = today_date; + start_date.tm_mon -= zoom_months[zoom]; + } graph_draw(window, symbol_info, symbol_info2, &start_date, zoom); } } |