ENHANCED: flush output for impure I/O (format/[2,3], portray_clause/1 etc.)

Without this, we do not get a (timely) prompt in cases like:

    ?- format("press a key: ", []), get_single_char(C).

whereas for example write/1 already works in such cases:

    ?- write('press a key: '), get_single_char(C).
    press a key:
This commit is contained in:
Markus Triska
2020-07-25 09:47:59 +02:00
parent e7c27ed999
commit dcc4b91b35

View File

@@ -377,7 +377,8 @@ format(Stream, Fs, Args) :-
% we use a specialised internal predicate that uses only a % we use a specialised internal predicate that uses only a
% single "write" operation for efficiency. It is equivalent to % single "write" operation for efficiency. It is equivalent to
% maplist(put_char(Stream), Cs). It also works for binary streams. % maplist(put_char(Stream), Cs). It also works for binary streams.
'$put_chars'(Stream, Cs). '$put_chars'(Stream, Cs),
flush_output(Stream).
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
?- phrase(cells("hello", [], 0, []), Cs). ?- phrase(cells("hello", [], 0, []), Cs).