Closed BrandonXLF closed 9 months ago
Could you please do the following ? (a) check that you are respecting this rule: https://docs.rs/rustyline/latest/rustyline/highlight/trait.Highlighter.html
Currently, the highlighted version must have the same display width as the original input.
(b) check that the provided example has the bug too: https://github.com/kkawakam/rustyline/blob/master/examples/example.rs#L23-L47
cargo run --example example
(I don't have access to a Windows 11 machine but only a Windows 10, I am going to check)
Cannot reproduce with the old cmd
shell or powershell
:
1> (abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuivwxyz abcdefg
hijklmno)
The example example
works as expected but minimal
does not. I've tested cmd, Windows Terminal, VS Code, and PowerShell.
Same here. Thanks.
Only occurs when color mode is enabled (which is on by default).
Indeed, with this local patch, minimal
example behaves correctly:
diff --git a/examples/minimal.rs b/examples/minimal.rs
index 9fc627e..d3ff7b0 100644
--- a/examples/minimal.rs
+++ b/examples/minimal.rs
@@ -1,9 +1,12 @@
-use rustyline::{DefaultEditor, Result};
+use rustyline::{ColorMode, Config, DefaultEditor, Result};
/// Minimal REPL
fn main() -> Result<()> {
env_logger::init();
- let mut rl = DefaultEditor::new()?;
+ let config = Config::builder()
+ .color_mode(ColorMode::Disabled)
+ .build();
+ let mut rl = DefaultEditor::with_config(config)?;
loop {
let line = rl.readline("> ")?; // read
println!("Line: {line}"); // eval / print
Ok, the issue must be here: https://github.com/kkawakam/rustyline/blob/ebbd5c116271a6910c5f9c1e5c61599f36f6cbcd/src/tty/windows.rs#L424-L435
@BrandonXLF Could you please give PR #739 a try ?
@BrandonXLF Could you please give PR #739 a try ?
Works as expected 👍
Version 13.0.0 released.
On Windows 11 (haven't tested 10) line wrapping doesn't line feed when the first line feed should be inserted. Line feeds for subsequent lines are inserted as expected. Only occurs when color mode is enabled (which is on by default).
This seems to be similar to #351. I tested
6.1.2
which resolved #351 but the issue is still present in that version.