aboutsummaryrefslogtreecommitdiff
path: root/ide/ideutils.ml
diff options
context:
space:
mode:
authorMaxime Dénès2018-03-09 15:31:48 +0100
committerMaxime Dénès2018-03-09 15:31:48 +0100
commit3d86afb36517c9ba4200289e169239f7fa54fca1 (patch)
tree0bb877f733155ac060c1a9d480ce18b35b4fbf72 /ide/ideutils.ml
parent6c43c26a98ea197e9c07b03b76e1916b9f94bb00 (diff)
parent079e895cad0a205e22202da5ba1a919a820c863b (diff)
Merge PR #6947: coqide: queries from the query window are routed there (fix #5684)
Diffstat (limited to 'ide/ideutils.ml')
-rw-r--r--ide/ideutils.ml12
1 files changed, 12 insertions, 0 deletions
diff --git a/ide/ideutils.ml b/ide/ideutils.ml
index 1786957597..bdb39e94a1 100644
--- a/ide/ideutils.ml
+++ b/ide/ideutils.ml
@@ -473,3 +473,15 @@ let browse_keyword prerr text =
let u = Lazy.force url_for_keyword text in
browse prerr (doc_url() ^ u)
with Not_found -> prerr ("No documentation found for \""^text^"\".\n")
+
+let rec is_valid (s : Pp.t) = match Pp.repr s with
+ | Pp.Ppcmd_empty
+ | Pp.Ppcmd_print_break _
+ | Pp.Ppcmd_force_newline -> true
+ | Pp.Ppcmd_glue l -> List.for_all is_valid l
+ | Pp.Ppcmd_string s -> Glib.Utf8.validate s
+ | Pp.Ppcmd_box (_,s)
+ | Pp.Ppcmd_tag (_,s) -> is_valid s
+ | Pp.Ppcmd_comment s -> List.for_all Glib.Utf8.validate s
+let validate s =
+ if is_valid s then s else Pp.str "This error massage can't be printed."