]> Repositorios git - scryer-prolog.git/commitdiff
set rustyline to check the cursor position (#802), don't add .pl extension to files...
authorMark Thom <[email protected]>
Sat, 6 Feb 2021 20:47:26 +0000 (13:47 -0700)
committerMark Thom <[email protected]>
Sat, 6 Feb 2021 20:47:26 +0000 (13:47 -0700)
src/loader.pl
src/machine/system_calls.rs
src/read.rs
src/toplevel.pl

index 0ac97ac66fd9c3d976f50899d3e24f606d02e61e..ca157855348a8ece07990e48684b173d2bf4c443 100644 (file)
@@ -35,7 +35,6 @@ expand_term(Term, ExpandedTerm) :-
     ;  Term = ExpandedTerm
     ).
 
-
 term_expansion_list([], ExpandedTerms, ExpandedTerms).
 term_expansion_list([Term|Terms], ExpandedTermsHead, ExpandedTermsTail) :-
     expand_term(Term, ExpandedTerm0),
@@ -310,9 +309,7 @@ use_module(Module, Exports) :-
 load_context_path(Module, Path) :-
     (  prolog_load_context(directory, CurrentDir) ->
        atom_concat(CurrentDir, Path, Module)
-    ;  atom_concat(_, '.pl', Module) ->
-       Module = Path
-    ;  atom_concat(Module, '.pl', Path)
+    ;  Module = Path
     ).
 
 
index 6990ed4072c260386a54eae3069c00a2ee502665..03aa12442aa6e526ff0b9fd259d87614cddc4ecb 100644 (file)
@@ -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) => {
                             match &self.heap[h] {
                                 &HeapCellValue::PartialString(_, true) => {
index ba97520182f4231109e49c38179a907ac13c9641..4ed74fbfdc963522188695f17acb068d53f04c6b 100644 (file)
@@ -17,7 +17,7 @@ pub type PrologStream = ParsingStream<Stream>;
 pub mod readline {
     use crate::machine::streams::Stream;
     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};
 
     static mut PROMPT: bool = false;
@@ -46,7 +46,11 @@ pub mod readline {
     impl ReadlineStream {
         #[inline]
         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() {
                 path.push(HISTORY_FILE);
                 if path.exists() {
index 09f28545ba94761e6da9ff31d5106e075a1647e2..8ff022420099e5eb319f676191fa30504492bdd9 100644 (file)
@@ -37,7 +37,8 @@ delegate_task([Arg0|Args], Goals0) :-
     ;   member(Arg0, ["-v", "--version"]) -> print_version
     ;   member(Arg0, ["-g", "--goal"]) -> gather_goal(g, Args, Goals0)
     ;   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).
 
@@ -122,7 +123,7 @@ instruction_match(Term, VarList) :-
              (  Item == user ->
                 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),