Skip to content

Commit ed9becb

Browse files
committed
Fix help link
1 parent 324f4b1 commit ed9becb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main/frege/frege/repl/FregeRepl.fr

+7-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ read console state = do
7979

8080
print :: ConsoleReader -> Command -> ReplResult -> ReplEnv -> IO ()
8181
print _ Java (JavaSource src) _ = javaSourceGUI src
82-
print _ (HelpDoc src) (DocHelp doc) _ = helpGUI src doc
82+
print _ (HelpDoc src) (DocHelp doc) _ = if null doc then return () else helpGUI src doc
8383
print console _ (ReplInfo msgs) _ = printMessages console msgs
8484
print console (cmd@(Eval line)) (CodeInfo sourceRepr g msgs) env = case sourceRepr of
8585
Expression sym | isVariable g sym =
@@ -295,7 +295,11 @@ helpGUI title content = do
295295
frame.setDefaultCloseOperation JFrame.dispose_on_close
296296
newContentPane:: JPanel <- BorderLayout.new () >>= JPanel.new
297297
let html :: String
298-
html = substring content $ indexOf content "<HTML>" -- Skip DOCTYPE
298+
html
299+
| index >= 0 = substring content index -- Skip DOCTYPE
300+
| otherwise = content
301+
where
302+
index = indexOf content "<HTML>"
299303
editor::JEditorPane <- JEditorPane.new "text/html" html
300304
editor.setEditable false
301305
helpLinksListener <- FregeJavaProxy.with showDesktop HyperlinkListener.clazz
@@ -328,7 +332,7 @@ derive ArrayElement Object
328332
type ObjectArray = JArray Object
329333

330334
fixHelpLink s | Just (Just relative : _)
331-
<- s `match` #^\.\.(.*)$# = "http://try.frege-lang.org/doc/frege" ++ relative
335+
<- s `match` #^\.\.(.*)$# = "http://www.frege-lang.org/doc/frege" ++ relative
332336
fixHelpLink s = s
333337

334338
native toURI :: URL -> ST s URI throws URISyntaxException

0 commit comments

Comments
 (0)