From 9a7862c3223149da81aff7eea5af61e6372279ad Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 21 Jul 2023 15:05:27 -0600 Subject: [PATCH] correct max_depth option (#1876) --- Cargo.lock | 44 +++++++++++++++----------------------------- Cargo.toml | 2 +- src/heap_print.rs | 4 +--- src/read.rs | 14 ++++++++------ 4 files changed, 25 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 15599610..72725aac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -351,7 +351,7 @@ version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a011bbe2c35ce9c1f143b7af6f94f29a167beb4cd1d29e6740ce836f723120e" dependencies = [ - "nix 0.26.2", + "nix", "windows-sys 0.48.0", ] @@ -758,6 +758,15 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +[[package]] +name = "home" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys 0.48.0", +] + [[package]] name = "hostname" version = "0.3.1" @@ -1149,15 +1158,6 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - [[package]] name = "mime" version = "0.3.17" @@ -1258,19 +1258,6 @@ dependencies = [ "smallvec", ] -[[package]] -name = "nix" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c" -dependencies = [ - "bitflags 1.3.2", - "cc", - "cfg-if", - "libc", - "memoffset", -] - [[package]] name = "nix" version = "0.26.2" @@ -1813,22 +1800,21 @@ checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" [[package]] name = "rustyline" -version = "9.1.2" +version = "12.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db7826789c0e25614b03e5a54a0717a86f9ff6e6e5247f92b369472869320039" +checksum = "994eca4bca05c87e86e15d90fc7a91d1be64b4482b38cb2d27474568fe7c9db9" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.3.3", "cfg-if", "clipboard-win", - "dirs-next", "fd-lock", + "home", "libc", "log", "memchr", - "nix 0.23.2", + "nix", "radix_trie", "scopeguard", - "smallvec", "unicode-segmentation", "unicode-width", "utf8parse", diff --git a/Cargo.toml b/Cargo.toml index c24d66f9..7db6c287 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,7 @@ ordered-float = "2.6.0" phf = { version = "0.9", features = ["macros"] } ref_thread_local = "0.0.0" rug = { version = "1.15.0", optional = true } -rustyline = "9.0.0" +rustyline = "12.0.0" ring = "0.16.13" ripemd160 = "0.8.0" sha3 = "0.8.2" diff --git a/src/heap_print.rs b/src/heap_print.rs index f1ac11ce..3463b0e0 100644 --- a/src/heap_print.rs +++ b/src/heap_print.rs @@ -1465,9 +1465,7 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> { let print_struct = |printer: &mut Self, name: Atom, arity: usize| { if name == atom!("[]") && arity == 0 { - if !printer.at_cdr("") { - append_str!(printer, "[]"); - } + append_str!(printer, "[]"); } else if arity > 0 { if let Some(spec) = fetch_op_spec(name, arity, printer.op_dir) { printer.handle_op_as_struct( diff --git a/src/read.rs b/src/read.rs index c21c3016..e5b3e8ba 100644 --- a/src/read.rs +++ b/src/read.rs @@ -17,6 +17,7 @@ use fxhash::FxBuildHasher; use indexmap::IndexSet; use rustyline::error::ReadlineError; +use rustyline::history::DefaultHistory; use rustyline::{Config, Editor}; use std::collections::VecDeque; @@ -109,7 +110,7 @@ fn get_prompt() -> &'static str { #[derive(Debug)] pub struct ReadlineStream { - rl: Editor, + rl: Editor, pending_input: CharReader>, add_history: bool, } @@ -117,10 +118,13 @@ pub struct ReadlineStream { impl ReadlineStream { #[inline] pub fn new(pending_input: &str, add_history: bool) -> Self { - let config = Config::builder().check_cursor_position(true).build(); + let config = Config::builder() + .check_cursor_position(true) + .build(); + let helper = Helper::new(); - let mut rl = Editor::with_config(config); + let mut rl = Editor::with_config(config).unwrap(); rl.set_helper(Some(helper)); if let Some(mut path) = dirs_next::home_dir() { @@ -130,8 +134,6 @@ impl ReadlineStream { } } - // rl.bind_sequence(KeyEvent::from('\t'), Cmd::Insert(1, "\t".to_string())); - ReadlineStream { rl, pending_input: CharReader::new(Cursor::new(pending_input.to_owned())), @@ -164,7 +166,7 @@ impl ReadlineStream { unsafe { if PROMPT { - self.rl.history_mut().add(self.pending_input.get_ref().get_ref()); + self.rl.add_history_entry(self.pending_input.get_ref().get_ref()).unwrap(); self.save_history(); PROMPT = false; } -- 2.54.0