Use a saner navigation logic - holymoly - A tor enabled gopher client written in CHICKEN scheme
(HTM) git clone git://vernunftzentrum.de/holymoly.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 144b5565d9b5dcc88bb2a209546d363f5efe64b6
(DIR) parent ba38ca12811a4b1c0fe67ea6fae55314ff036035
(HTM) Author: Christian Kellermann <ckeen@pestilenz.org>
Date: Wed, 25 Apr 2018 09:58:56 +0200
Use a saner navigation logic
Diffstat:
holymoly.scm | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
---
(DIR) diff --git a/holymoly.scm b/holymoly.scm
@@ -89,7 +89,7 @@
((#x106) (when use-cursor (set! cursor (list->cursor selectables))) (set! pos 0)) ; HOME
((#x168) (when use-cursor #;
(set! cursor (sub1 (length dlines)))) (set! pos (max pos (- nlines pos rows)))) ; end
- ((260) (if use-cursor (k (previous-page)) (k #f)))
+ ((260) (k 'back))
((32)
(set! pos (if (> (+ pos rows) nlines) pos (+ pos (sub1 rows))))
(when use-cursor
@@ -111,7 +111,7 @@
((< (+ pos (length dlines)) (current-cursor cursor))
(prev-cursor! cursor)
(adjust-cursor!)))))) ; backspace
- ((113) (k #f)) ; q
+ ((113) (k 'quit)) ; q
((#x47 #x67) (k (uri->entry (get-user-input "New uri:" (uri->string (entry->uri (current-page)))))) pos) ; G
(else pos)))))))))
@@ -287,14 +287,10 @@
(new-status "~a" (uri->string (entry->uri e)))
(handler res))))
(new-status "~a" next)
- (if next
- (select-entry next)
- (unless (equal? 'directory (entry-type (current-page)))
- (select-entry (current-page))))))
-
-(define (index-entry server #!optional (port gopher-port))
- (make-entry 'directory "" index server port '()))
-
+ (cond
+ ((equal? next 'quit) (exit 0))
+ ((equal? next 'back) (select-entry (previous-page)))
+ (else (select-entry next)))))
(define (uri->entry uri-string)
(let* ((u (uri-reference uri-string))