kkawakam / rustyline

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

Add option to disable newline after every command #756

Open fcoury opened 6 months ago

fcoury commented 6 months ago

I am writing a neovim clone in Rust and the unconditional writeln()? on the readline_with method makes my whole screen scroll up every time the user enters a command.

I added a new enable_newline flag to the config, which defaults to true and created all the wrapper methods needed. Finally I changed the readline_with method to check the flag before issuing the writeln command.

gwenn commented 6 months ago

See https://www.javadoc.io/static/org.jline/jline/3.25.0/org/jline/reader/LineReader.Option.html#ERASE_LINE_ON_FINISH So maybe we should use an enum instead of a boolean:

enum EndMode { // TODO find a better name
    Erase,
    NewLine,
    None,    
}