]> gitweb.factorcode.org Git - factor.git/commitdiff
gopher.ui: open non-gopher urls using webbrowser vocab.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sun, 19 Nov 2017 22:04:45 +0000 (14:04 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 19 Nov 2017 22:04:45 +0000 (14:04 -0800)
extra/gopher/ui/ui.factor

index f60ad7e2459ef9a1b4275ca5d5f257328bfbe7ec..3e33a92853d49111b263d09de18c218d175fc003 100644 (file)
@@ -6,7 +6,7 @@ kernel math.vectors models present sequences ui ui.commands ui.gadgets
 ui.gadgets.editors ui.gadgets.panes ui.gadgets.scrollers
 ui.gadgets.status-bar ui.gadgets.toolbar ui.gadgets.tracks
 ui.gadgets.viewports ui.gestures ui.operations ui.tools.browser
-ui.tools.browser.history ui.tools.common urls ;
+ui.tools.browser.history ui.tools.common urls webbrowser ;
 
 IN: gopher.ui
 
@@ -29,12 +29,14 @@ M: gopher-gadget model-changed
 
 : show-gopher ( url gopher-gadget -- )
     [ [ >url ] [ f ] if* ] dip
-    [
-        2dup control-value =
-        [ 2drop ] [ nip history>> add-history ] if
-    ]
-    [ set-control-value ]
-    2bi ;
+    over [ protocol>> "gopher" = ] [ t ] if* [
+        [
+            2dup control-value =
+            [ 2drop ] [ nip history>> add-history ] if
+        ]
+        [ set-control-value ]
+        2bi
+    ] [ drop open-url ] if ;
 
 : <url-field> ( gopher-gadget -- field )
     '[ >url _ show-gopher ] <action-field>