M utils.rkt => utils.rkt +8 -1
@@ 39,6 39,13 @@
(define (unescape-amp content)
(string-replace content "&" "&"))
(define (unescape-chars content)
- (string-replace (string-replace (string-replace content "<" "<") ">" ">") """ "'"))
+ (string-replace (string-replace (string-replace content "<" "<") ">" ">") """ "'"))
(unescape-amp (unescape-gt (unescape-lt (unescape-chars content)))))
+;; If the url doesn't contains a scheme, use gemini://
+;; should add a test here
+(define (ensure-scheme current-url)
+ (define current-url-url (string->url current-url))
+ (if (url-scheme (string->url current-url))
+ current-url
+ (string-append "gemini://" current-url)))
M window.rkt => window.rkt +3 -4
@@ 94,10 94,9 @@
(define (go-to-url [url #f])
(when (false? url)
- (set! url (send address-bar get-value)))
-
- (set! history-backward (cons url history-backward))
- (send multi-transport fetch url))
+ (let ([url (ensure-scheme (send address-bar get-value))])
+ (set! history-backward (cons url history-backward))
+ (send multi-transport fetch url))))
(define (go-forward)
(when (> (length history-forward) 0)