set rustyline to check the cursor position (#802), don't add .pl extension to files in loader.pl (#800)

This commit is contained in:
Mark Thom
2021-02-06 13:47:26 -07:00
parent 49b1c1368e
commit 3f950490f9
4 changed files with 14 additions and 8 deletions

View 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() {