]> gitweb.factorcode.org Git - factor.git/commitdiff
webbrowser: faster url-string? prototype
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 1 May 2023 15:53:25 +0000 (08:53 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 1 May 2023 15:53:25 +0000 (08:53 -0700)
basis/webbrowser/webbrowser.factor

index bbba06f766eaf138a799c59c089465e222c69cda..51f07e9abbd26ba7e37e6e1308281abf393c75e1 100644 (file)
@@ -1,7 +1,10 @@
 ! Copyright (C) 2011 John Benediktsson
 ! See https://factorcode.org/license.txt for BSD license
-USING: accessors command-line io.pathnames kernel namespaces
-sequences strings system ui.operations urls vocabs ;
+
+USING: accessors combinators.short-circuit command-line
+io.pathnames kernel namespaces sequences strings system
+ui.operations urls vocabs ;
+
 IN: webbrowser
 
 HOOK: open-item os ( item -- )
@@ -11,7 +14,11 @@ HOOK: open-item os ( item -- )
 : open-url ( url -- )
     >url open-item ;
 
-PREDICATE: url-string < string >url protocol>> >boolean ;
+PREDICATE: url-string < string
+    {
+        [ "://" subseq-index ]
+        [ >url protocol>> >boolean ]
+    } 1&& ;
 
 [ pathname? ] \ open-item H{ } define-operation
 [ [ url? ] [ url-string? ] bi or ] \ open-url H{ } define-operation