kkawakam / rustyline

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

Implement ExternalPrinterWriter #798

Open xeruf opened 3 weeks ago

xeruf commented 3 weeks ago

To enable duplex output of log messages

Fixes #797

xeruf commented 3 weeks ago

Only Problem: When rustyline logs at debug level, the prompt somehow does not work. Fixed in my project by .filter(Some("rustyline"), LevelFilter::Warn)

gwenn commented 3 weeks ago

I am afraid that on incomplete / partial write, rustyline is going to append newline (\n) where they are not expected. See https://github.com/kkawakam/rustyline/blob/e4eca97cbbff139278c153e40aa285920d2637dd/src/edit.rs#L324-L326

xeruf commented 3 weeks ago

That is why the method was called println in the rustylinez fork, but that is not the main problem even though it is not quite ideal. The readline function completely hangs when at debug level for rustyline, probably they somehow interfere with each other.

gwenn commented 2 weeks ago

Indeed, it should be named println. But initially, there was no newline appended automatically until: https://github.com/kkawakam/rustyline/issues/629 https://github.com/kkawakam/rustyline/pull/627