Show the current gopher URI in status window - 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 76540ec5fe88b93b47c89c9a96c31b3382a87a1c
(DIR) parent a9e195abdd717071b6f6683e691872bb09d322f9
(HTM) Author: Christian Kellermann <ckeen@pestilenz.org>
Date: Wed, 7 Mar 2018 22:24:29 +0100
Show the current gopher URI in status window
Diffstat:
holymoly.scm | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/holymoly.scm b/holymoly.scm
@@ -48,6 +48,8 @@
(string-take (renderer (car l)) (sub1 cols))
(renderer (car l))))
(when (and use-cursor (= (+ pos i) (current-cursor cursor)))
+ (let ((e (list-ref lines (+ pos i))))
+ (new-status "gopher://~a:~a/~a~a" (entry-host e) (entry-port e) (type->string (entry-type e)) (entry-selector e)))
(mvwchgat win i 0 -1 A_STANDOUT 0 #f))
(draw (cdr l) (add1 i))))
(wrefresh win)
@@ -160,8 +162,8 @@
(pp (condition->list e))
(abort e))))
-(define (string->type str)
- (let ((mapping-table
+
+ (define mapping-table
'(("i" . info)
("0" . file)
("1" . directory)
@@ -176,8 +178,14 @@
("+" . redundant-server)
("T" . tn3270-session)
("g" . gif)
- ("I" . image))))
- (or (alist-ref str mapping-table equal?) 'unknown)))
+ ("I" . image)))
+
+ (define (swap pair) (cons (cdr pair) (car pair)))
+ (define (string->type str)
+ (or (alist-ref str mapping-table equal?) 'unknown))
+
+ (define (type->string type)
+ (or (alist-ref type (map swap mapping-table) equal?) "3"))
(define (string->entry str)
(condition-case