commit d0e29b8dd6c254666a904bdd06981739865fb0ee
parent 64b98070e6a796387b1912017716e3724f4d7ca0
Author: William Casarin <jb55@jb55.com>
Date: Mon, 1 Oct 2018 13:11:43 -0700
implement t binding
set's current hilight to now
Diffstat:
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git a/viscal.c b/viscal.c
@@ -593,6 +593,13 @@ static void move_down(struct cal *cal, int repeat)
cal->current += cal->timeblock_size * 60;
}
+static void move_now(struct cal *cal)
+{
+ time_t now = time(NULL);
+ cal->current =
+ closest_timeblock_for_timet(now, cal->timeblock_size);
+}
+
static int query_span(struct cal *cal, int index_hint, time_t start, time_t end,
time_t min_start, time_t max_end)
{
@@ -710,6 +717,10 @@ static gboolean on_keypress (GtkWidget *widget, GdkEvent *event, gpointer user_
cal->repeat = 1;
break;
+ case 't':
+ move_now(cal);
+ break;
+
case 'u':
cal->scroll -= scroll_amt;
cal->repeat = 1;