aboutsummarylogtreecommitdiffstats
path: root/info.c
diff options
context:
space:
mode:
authorAntony Kellermann2018-05-30 22:04:59 -0400
committerAntony Kellermann2018-05-30 22:04:59 -0400
commit7b7f25c75e47464a5b66a99795f272d0455d43cb (patch)
treedcaabae586e56f86b73b7b00b747b266340865fa /info.c
parent89e1ac2e2c7fd4ba7ea10d68233547e206bb44db (diff)
downloadaur-7b7f25c75e47464a5b66a99795f272d0455d43cb.tar.gz
Fixed graph zooming past current date bug
Diffstat (limited to 'info.c')
-rw-r--r--info.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/info.c b/info.c
index 9c66690cb5c5..91a2124fdc24 100644
--- a/info.c
+++ b/info.c
@@ -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);
}
}