M CHANGELOG.md => CHANGELOG.md +1 -0
@@ 10,6 10,7 @@
* Enable reorder of tabs
* Requires Racket v8.0
* Use system-default fonts
+* Window is now read-only on Gemini pages
# Version 0.10
M README.md => README.md +5 -4
@@ 2,7 2,7 @@
![Fafi browser running](fafi.gif)
-Fafi is a Gemini browser written in [Racket](https://racket-lang.org). It is early days for this code base and there is much work to be done. At the moment the happy path for loading `text/gemini` and `text/plain` is working but I still need to implement the handling of the other status codes and mime types. This begun as just an experiment to calm me during my free hours, now I want to make it into a real gemini browser.
+Fafi is a Gemini browser written in [Racket](https://racket-lang.org). It is early days for this code base and there is much work to be done. At the moment the happy path for loading `text/gemini` and `text/plain` is working but I still need to implement the handling of the other status codes and mime types. This begun as just an experiment to calm me during my free hours, now I want to make it into a real gemini browser.
## What is gemini protocol?
@@ 51,8 51,9 @@ That will create a `dist/` folder and place a distributable version of Fafi insi
* Home: go to homepage.
* alt+left: go back.
* alt+right: go forward.
-* ctrl+w: close tab.
-* ctrl+t: new tab.
+* ctrl+w / cmd+w: close tab.
+* ctrl+t / cmd+t: new tab.
+* ctrl-l / cmd+l: jump to address bar.
* ctrl+q: quit.
* middle-button click: opens link in a new tab.
* ctrl+h: opens history queue.
@@ 77,7 78,7 @@ If you want you can [buy me a coffee at ko-fi](https://ko-fi.com/andregarzia). Y
# Thanks
* Erkin: For reaching out on Mastodon with a [Racket-based Gopher client](https://github.com/erkin/gophwr/) full of inspiring code for me to look at. I got a lot of useful code snippets from Gophwr :heart:
* Alex HHH: For the marvelous work wiht Racket and the prolific blogging that taught me so much, also for this [specific blog post about creating a markdown viewer with Racket](https://alex-hhh.github.io/2020/05/markdown-view.html) from which I stole the basis for `gemini-view%`, `gemini-renderer%`, and `markdown-renderer%`.
-* m455: For the encouragement in all things Racket.
+* m455: For the encouragement in all things Racket.
* Maleficient: For helping me understand style deltas.
* Cel: For introducing me to Gemini.
M renderers/gemini-renderer.rkt => renderers/gemini-renderer.rkt +13 -13
@@ 8,9 8,9 @@
(define gemini-renderer%
(class object%
-
+
(super-new)
-
+
(init-field
parent
[on-status-change (void)]
@@ 31,7 31,7 @@
[parent pane]
[style '(no-border no-hscroll auto-vscroll)]
[wheel-step 3]))
-
+
(define text
(new
(class text% (super-new)
@@ 87,7 87,7 @@
(send text set-padding 10 10 10 10)
(define preformatted #f)
-
+
(define/public (clear)
(send text begin-edit-sequence)
(send text select-all)
@@ 95,12 95,12 @@
(send text end-edit-sequence)
(send editor scroll-to 0 0 0 0 #t)
(send text hide-caret #t))
-
+
(define (insert-with-styles txt styles [snip #f])
(when (false? snip)
(set! snip (make-object string-snip% txt)))
(when preformatted
- (set! styles (cons code-style styles)))
+ (set! styles (cons code-style styles)))
(let ((start (send text last-position)))
(send text insert snip)
(define end (send text last-position))
@@ 123,8 123,6 @@
[(eq? level 6) (insert-with-styles txt (cons h6-style style-list))]
[else (insert-with-styles txt (cons h6-style style-list))]))
-
-
(define (insert-link link label style-list)
(when (not (non-empty-string? label)) (set! label link))
(let ((start (send text last-position)))
@@ 141,7 139,7 @@
(on-request-navigation link))
hyperlink-clicked-style)
)))
-
+
(define (display-gemtext body)
(define initial-style-list (list base-style))
(define (line->string line)
@@ 154,22 152,24 @@
[(eq? type 'break) (insert-newline)]
[(eq? type 'preformatted) (set! preformatted (second line))]
[else (insert-with-styles (second line) initial-style-list)]))
-
+
+ (send text lock #f)
(send text begin-edit-sequence)
(clear)
(when body
(for-each line->string body))
(send text end-edit-sequence)
(send editor scroll-to 0 0 0 0 #t)
- (on-render-complete))
+ (on-render-complete)
+ (send text lock #t))
(define/public (set-content content)
(display-gemtext content)
(send pane show #t))
-
+
(define/public (can-handle-mime? mime content)
(matches-mime "text/gemini" mime))
-
+
))
(provide gemini-renderer%)