From 302363f5cb90720d32245a4c849ed92a12acb719 Mon Sep 17 00:00:00 2001 From: Ryan Kavanagh Date: Mon, 8 Jun 2020 22:04:58 -0400 Subject: Fix notty issues involving newlines --- bin/leda.ml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/leda.ml b/bin/leda.ml index 4b86330..98e6244 100644 --- a/bin/leda.ml +++ b/bin/leda.ml @@ -29,8 +29,18 @@ let () = let h = (I.string A.empty ("STATUS: " ^ (R.name_of_response r))) <-> (I.string A.empty ("STATUS LINE: " ^ (R.header_of_response r))) in let c = match r with - | SUCCESS (_, c) | SUCCESS_EOCSS (_, c) -> I.string A.empty c + | SUCCESS (_, c) | SUCCESS_EOCSS (_, c) -> + (try + let parsed = M.str_to_gemini c in + List.fold parsed + ~init:I.empty + ~f:(fun acc -> fun l -> + acc <-> (I.string A.empty (M.gemini_line_to_str l))) + with + | M.ParseError m -> + I.string A.empty ("Failed to parse contents: " ^ m)) | _ -> I.empty in + let _ = (fun _ -> ()) (h, c) in let%lwt () = Term.image t (h <-> c) in let%lwt () = Term.refresh t in loop t -- cgit v1.2.3