support 'h' to print help message during toplevel interaction
This commit is contained in:
@@ -33,6 +33,7 @@ use crate::crossterm::terminal::{enable_raw_mode, disable_raw_mode};
|
|||||||
pub enum ContinueResult {
|
pub enum ContinueResult {
|
||||||
ContinueQuery,
|
ContinueQuery,
|
||||||
Conclude,
|
Conclude,
|
||||||
|
Help,
|
||||||
PrintWithoutMaxDepth,
|
PrintWithoutMaxDepth,
|
||||||
PrintWithMaxDepth
|
PrintWithMaxDepth
|
||||||
}
|
}
|
||||||
@@ -54,6 +55,9 @@ pub fn next_keypress() -> ContinueResult {
|
|||||||
KeyCode::Char('.') => {
|
KeyCode::Char('.') => {
|
||||||
return ContinueResult::Conclude;
|
return ContinueResult::Conclude;
|
||||||
}
|
}
|
||||||
|
KeyCode::Char('h') => {
|
||||||
|
return ContinueResult::Help;
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2351,6 +2355,7 @@ impl MachineState {
|
|||||||
let c = match keypress {
|
let c = match keypress {
|
||||||
ContinueResult::ContinueQuery => ';',
|
ContinueResult::ContinueQuery => ';',
|
||||||
ContinueResult::Conclude => '.',
|
ContinueResult::Conclude => '.',
|
||||||
|
ContinueResult::Help => 'h',
|
||||||
ContinueResult::PrintWithoutMaxDepth => 'w',
|
ContinueResult::PrintWithoutMaxDepth => 'w',
|
||||||
ContinueResult::PrintWithMaxDepth => 'p',
|
ContinueResult::PrintWithMaxDepth => 'p',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -196,10 +196,21 @@
|
|||||||
'$read_input'(ThreadedGoals, NewVarList)
|
'$read_input'(ThreadedGoals, NewVarList)
|
||||||
; C == (';') ->
|
; C == (';') ->
|
||||||
nl, write('; '), false
|
nl, write('; '), false
|
||||||
|
; C == h ->
|
||||||
|
'$help_message',
|
||||||
|
'$read_input'(ThreadedGoals, NewVarList)
|
||||||
; C == '.',
|
; C == '.',
|
||||||
nl, write(' ...'), nl
|
nl, write(' ...'), nl
|
||||||
).
|
).
|
||||||
|
|
||||||
|
'$help_message' :-
|
||||||
|
nl, nl,
|
||||||
|
write('SPACE, "n" or ";": next solution, if any\n'),
|
||||||
|
write('".": stop enumeration\n'),
|
||||||
|
write('"h": display this help message\n'),
|
||||||
|
write('"w": write terms without depth limit\n'),
|
||||||
|
write('"p": print terms with depth limit\n\n').
|
||||||
|
|
||||||
'$gather_query_vars'([_ = Var | Vars], QueryVars) :-
|
'$gather_query_vars'([_ = Var | Vars], QueryVars) :-
|
||||||
( var(Var) ->
|
( var(Var) ->
|
||||||
QueryVars = [Var | QueryVars1],
|
QueryVars = [Var | QueryVars1],
|
||||||
|
|||||||
Reference in New Issue
Block a user