fix |: prompt with readline.

This commit is contained in:
Vitor Santos Costa 2011-05-01 22:43:54 +01:00
parent cfe65cea0a
commit fa5989587d
1 changed files with 8 additions and 9 deletions

View File

@ -144,18 +144,18 @@ true :- true.
*/ */
/* main execution loop */ /* main execution loop */
'$read_vars'(user_input, Goal, Mod, Pos, Bindings) :- '$read_vars'(user_input, Goal, Mod, Pos, Bindings, Prompt) :-
'$swi_current_prolog_flag'(readline, true), '$swi_current_prolog_flag'(readline, true),
read_history(h, '!h', read_history(h, '!h',
[trace, end_of_file], [trace, end_of_file],
' ?- ', Goal, Bindings), !, Prompt, Goal, Bindings), !,
(nonvar(Err) -> (nonvar(Err) ->
print_message(error,Err), fail print_message(error,Err), fail
; ;
true true
). ).
'$read_vars'(Stream,T,Mod,Pos,V) :- '$read_vars'(Stream, T, Mod, Pos, V, _Prompt) :-
'$read'(true,T,Mod,V,Pos,Err,Stream), '$read'(true, T, Mod, V, Pos, Err, Stream),
(nonvar(Err) -> (nonvar(Err) ->
print_message(error,Err), fail print_message(error,Err), fail
; ;
@ -195,13 +195,12 @@ true :- true.
prompt(_,'| '), prompt(_,'| '),
prompt1(' ?- '), prompt1(' ?- '),
'$run_toplevel_hooks', '$run_toplevel_hooks',
'$read_vars'(user_input,Command,_,Pos,Varnames), '$read_vars'(user_input,Command,_,Pos,Varnames, ' ?- '),
nb_setval('$spy_gn',1), nb_setval('$spy_gn',1),
% stop at spy-points if debugging is on. % stop at spy-points if debugging is on.
nb_setval('$debug_run',off), nb_setval('$debug_run',off),
nb_setval('$debug_jump',off), nb_setval('$debug_jump',off),
prompt(_,'|: '), prompt1('|: '),
'$command'(Command,Varnames,Pos,top), '$command'(Command,Varnames,Pos,top),
'$sync_mmapped_arrays', '$sync_mmapped_arrays',
set_value('$live','$false'). set_value('$live','$false').
@ -1141,7 +1140,7 @@ bootstrap(F) :-
!. !.
'$enter_command'(Stream,Status) :- '$enter_command'(Stream,Status) :-
'$read_vars'(Stream,Command,_,Pos,Vars), '$read_vars'(Stream,Command,_,Pos,Vars, '|: '),
'$command'(Command,Vars,Pos,Status). '$command'(Command,Vars,Pos,Status).
'$abort_loop'(Stream) :- '$abort_loop'(Stream) :-