aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-08-10 11:27:22 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-08-10 11:27:22 +0200
commitc8c3810f380e6228a766f560489262a2b685b507 (patch)
tree4f4a4a0d6dad9ed5fa41011f7e9988c85763d787
parentPartial search page works, but alway times out first. (diff)
downloadcalp-c8c3810f380e6228a766f560489262a2b685b507.tar.gz
calp-c8c3810f380e6228a766f560489262a2b685b507.tar.xz
Add support for arrow keys in term.
-rw-r--r--module/output/terminal.scm26
1 files changed, 18 insertions, 8 deletions
diff --git a/module/output/terminal.scm b/module/output/terminal.scm
index 4d12b48d..8fcb9cd5 100644
--- a/module/output/terminal.scm
+++ b/module/output/terminal.scm
@@ -161,12 +161,12 @@
(set! (page-length this) (length (cached-events this)))
(case char
- ((#\L #\l)
+ ((#\L #\l right)
(set! (current-page this) = add-day
(cached-events this) #f
(active-element this) 0))
- ((#\h #\H)
+ ((#\h #\H left)
(set! (current-page this) = remove-day
(cached-events this) #f
(active-element this) 0))
@@ -280,14 +280,15 @@
(define-method (input (this <view>) char)
(case char
- ((#\j #\J) (unless (= (active-element this) (1- (page-length this)))
- (set! (active-element this) = (+ 1))))
- ((#\k #\K) (unless (= (active-element this) 0)
- (set! (active-element this) = (- 1))))
+ ((#\j #\J down) (unless (= (active-element this) (1- (page-length this)))
+ (set! (active-element this) = (+ 1))))
+ ((#\k #\K up) (unless (= (active-element this) 0)
+ (set! (active-element this) = (- 1))))
((#\g) (set! (active-element this) 0))
((#\G) (set! (active-element this) (1- (page-length this))))
+
((#\q) '(pop)))
)
@@ -301,8 +302,8 @@
(current-page this))
(active-element this))
'DTSTART)))))
- ((#\h) (set! (current-page this) = ((lambda (old) (max 0 (1- old))))))
- ((#\l)
+ ((#\h left) (set! (current-page this) = ((lambda (old) (max 0 (1- old))))))
+ ((#\l right)
(display "\n loading...\n")
(set! (current-page this)
(next-page (slot-ref this 'search-result)
@@ -319,6 +320,15 @@
(when (eof-object? char)
(break))
+ (when (char=? char #\escape)
+ (case (read-char)
+ ((#\[)
+ (case (read-char)
+ ((#\A) (set! char 'up))
+ ((#\B) (set! char 'down))
+ ((#\C) (set! char 'right))
+ ((#\D) (set! char 'left))))))
+
(match (input (car state) char)
(('push new-state) (set! state (cons new-state state)))
(('pop)