kkawakam / rustyline

Readline Implementation in Rust
https://crates.io/crates/rustyline/
MIT License
1.52k stars 175 forks source link

Make MemHistory::default() be a wrapper around MemHistory::new() to avoid that max_len is defaulted to 0. #686

Closed tage64 closed 1 year ago

tage64 commented 1 year ago

I found that when creating MemHistory from Default::default(), the max_len (that is the maximum size of the history) is initialized to 0 due to the #[derive(Default)] on the MemHistory struct. This is counter intuative since the history doesn't work as a history at all in that case.

I changed the Default implementation to call MemHistory::new() instead. Then the history max length will be initialized to 100 instead.

gwenn commented 1 year ago

Thanks.