summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Geier <christian.geier@justadd.ai>2023-05-30 20:53:14 +0200
committerChristian Geier <christian.geier@justadd.ai>2023-06-07 20:00:46 +0200
commit7c99fb81347a983784583f397aa9b19d168e5b8d (patch)
tree8fc92d90d41ec94916f4af7da31561c10b6ce529
parent9f597f666b4e83406a0dd71244ab7a65b59b705f (diff)
long jumps in ikhal don't crash it
Before, making the CalendarWidget jump to a date that was more than one month away from the already loaded dates raised an exception. fix #1200
-rw-r--r--khal/ui/calendarwidget.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/khal/ui/calendarwidget.py b/khal/ui/calendarwidget.py
index fe911dd0..da2df441 100644
--- a/khal/ui/calendarwidget.py
+++ b/khal/ui/calendarwidget.py
@@ -418,14 +418,14 @@ class CalendarWalker(urwid.SimpleFocusListWalker):
# will lead to an autoprepend which will f*ck up our estimation,
# therefore better autoprepending anyway, even if it might not be
# necessary
- if new_focus <= 1:
+ while new_focus <= 1:
self._autoprepend()
week_diff = int((self.focus_date - a_day).days / 7)
new_focus = self.focus - week_diff
for offset in [0, -1, 1]: # we might be off by a week
row = new_focus + offset
try:
- if row >= len(self):
+ while row >= len(self):
self._autoextend()
column = self[row].get_date_column(a_day)
return row, column