set rustyline to check the cursor position (#802), don't add .pl extension to files in loader.pl (#800)
This commit is contained in:
@@ -35,7 +35,6 @@ expand_term(Term, ExpandedTerm) :-
|
|||||||
; Term = ExpandedTerm
|
; Term = ExpandedTerm
|
||||||
).
|
).
|
||||||
|
|
||||||
|
|
||||||
term_expansion_list([], ExpandedTerms, ExpandedTerms).
|
term_expansion_list([], ExpandedTerms, ExpandedTerms).
|
||||||
term_expansion_list([Term|Terms], ExpandedTermsHead, ExpandedTermsTail) :-
|
term_expansion_list([Term|Terms], ExpandedTermsHead, ExpandedTermsTail) :-
|
||||||
expand_term(Term, ExpandedTerm0),
|
expand_term(Term, ExpandedTerm0),
|
||||||
@@ -310,9 +309,7 @@ use_module(Module, Exports) :-
|
|||||||
load_context_path(Module, Path) :-
|
load_context_path(Module, Path) :-
|
||||||
( prolog_load_context(directory, CurrentDir) ->
|
( prolog_load_context(directory, CurrentDir) ->
|
||||||
atom_concat(CurrentDir, Path, Module)
|
atom_concat(CurrentDir, Path, Module)
|
||||||
; atom_concat(_, '.pl', Module) ->
|
; Module = Path
|
||||||
Module = Path
|
|
||||||
; atom_concat(Module, '.pl', Path)
|
|
||||||
).
|
).
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3349,6 +3349,10 @@ impl MachineState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Addr::Char(c) => {
|
||||||
|
let atom = clause_name!(c.to_string(), self.atom_tbl);
|
||||||
|
self.stream_from_file_spec(atom, indices, &options)?
|
||||||
|
}
|
||||||
Addr::PStrLocation(h, n) => {
|
Addr::PStrLocation(h, n) => {
|
||||||
match &self.heap[h] {
|
match &self.heap[h] {
|
||||||
&HeapCellValue::PartialString(_, true) => {
|
&HeapCellValue::PartialString(_, true) => {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ pub type PrologStream = ParsingStream<Stream>;
|
|||||||
pub mod readline {
|
pub mod readline {
|
||||||
use crate::machine::streams::Stream;
|
use crate::machine::streams::Stream;
|
||||||
use crate::rustyline::error::ReadlineError;
|
use crate::rustyline::error::ReadlineError;
|
||||||
use crate::rustyline::{Cmd, Editor, KeyEvent};
|
use crate::rustyline::{Cmd, Config, Editor, KeyEvent};
|
||||||
use std::io::{Cursor, Error, ErrorKind, Read};
|
use std::io::{Cursor, Error, ErrorKind, Read};
|
||||||
|
|
||||||
static mut PROMPT: bool = false;
|
static mut PROMPT: bool = false;
|
||||||
@@ -46,7 +46,11 @@ pub mod readline {
|
|||||||
impl ReadlineStream {
|
impl ReadlineStream {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new(pending_input: String) -> Self {
|
pub fn new(pending_input: String) -> Self {
|
||||||
let mut rl = Editor::<()>::new();
|
let config = Config::builder()
|
||||||
|
.check_cursor_position(true)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let mut rl = Editor::<()>::with_config(config); //Editor::<()>::new();
|
||||||
if let Some(mut path) = dirs_next::home_dir() {
|
if let Some(mut path) = dirs_next::home_dir() {
|
||||||
path.push(HISTORY_FILE);
|
path.push(HISTORY_FILE);
|
||||||
if path.exists() {
|
if path.exists() {
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ delegate_task([Arg0|Args], Goals0) :-
|
|||||||
; member(Arg0, ["-v", "--version"]) -> print_version
|
; member(Arg0, ["-v", "--version"]) -> print_version
|
||||||
; member(Arg0, ["-g", "--goal"]) -> gather_goal(g, Args, Goals0)
|
; member(Arg0, ["-g", "--goal"]) -> gather_goal(g, Args, Goals0)
|
||||||
; atom_chars(Mod, Arg0),
|
; atom_chars(Mod, Arg0),
|
||||||
catch(use_module(Mod), E, print_exception(E))
|
catch(use_module(Mod), E, print_exception(E)),
|
||||||
|
nl
|
||||||
),
|
),
|
||||||
delegate_task(Args, Goals0).
|
delegate_task(Args, Goals0).
|
||||||
|
|
||||||
@@ -122,7 +123,7 @@ instruction_match(Term, VarList) :-
|
|||||||
( Item == user ->
|
( Item == user ->
|
||||||
catch(load(user_input), E, print_exception_with_check(E))
|
catch(load(user_input), E, print_exception_with_check(E))
|
||||||
;
|
;
|
||||||
consult(Item)
|
submit_query_and_print_results(consult(Item), [])
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
catch(type_error(atom, Item, repl/0),
|
catch(type_error(atom, Item, repl/0),
|
||||||
|
|||||||
Reference in New Issue
Block a user