Don't stylise uge strings

Fix #73
This commit is contained in:
Jeremie Dimino 2014-06-24 14:25:49 +01:00
parent 6124f722f0
commit deccc8ea16
1 changed files with 14 additions and 10 deletions

View File

@ -231,16 +231,20 @@ let fix_string str =
end end
let render_out_phrase term string = let render_out_phrase term string =
let string = fix_string string in if String.length string >= 100 * 1024 then
let styled = LTerm_text.of_string string in LTerm.fprint term string
let stylise loc token_style = else begin
for i = loc.idx1 to loc.idx2 - 1 do let string = fix_string string in
let ch, style = styled.(i) in let styled = LTerm_text.of_string string in
styled.(i) <- (ch, LTerm_style.merge token_style style) let stylise loc token_style =
done for i = loc.idx1 to loc.idx2 - 1 do
in let ch, style = styled.(i) in
UTop_styles.stylise stylise (UTop_lexer.lex_string (UTop.get_syntax ()) string); styled.(i) <- (ch, LTerm_style.merge token_style style)
LTerm.fprints term styled done
in
UTop_styles.stylise stylise (UTop_lexer.lex_string (UTop.get_syntax ()) string);
LTerm.fprints term styled
end
let orig_print_out_signature = !Toploop.print_out_signature let orig_print_out_signature = !Toploop.print_out_signature
let orig_print_out_phrase = !Toploop.print_out_phrase let orig_print_out_phrase = !Toploop.print_out_phrase