correct max_depth option (#1876)

This commit is contained in:
Mark
2023-07-21 15:05:27 -06:00
parent 92c77cdff5
commit 9a7862c322
4 changed files with 25 additions and 39 deletions

View File

@@ -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(

View File

@@ -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<Helper>,
rl: Editor<Helper, DefaultHistory>,
pending_input: CharReader<Cursor<String>>,
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;
}