kkawakam / rustyline

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

avoid panic: `entry[pos..]` => `entry.get(pos..)` #776

Open lengyijun opened 5 months ago

gwenn commented 5 months ago

I may be wrong but: We have:

        if line.is_empty() || pos < line.len() {
            return None;
        }

So pos == line.len() && pos > 0. So I guess that the panic can happen only if history returns an entry that doesn't start with line. Which seems fine to me.