Closed SalHe closed 5 months ago
See #690
Cannot reproduce locally:
% cargo run --example minimal
> line1
line2
line3
line4
line5
Line: line1
line2
line3
line4
line5
>
I tried with unix, mac, dos file content
Cannot reproduce locally:
% cargo run --example minimal > line1 line2 line3 line4 line5 Line: line1 line2 line3 line4 line5 >
I tried with unix, mac, dos file content
Sorry I forgot to note that: rl.bind_sequence(KeyEvent(KeyCode::BracketedPasteStart, Modifiers::NONE), Cmd::Noop);
should be configured.
use rustyline::{DefaultEditor, Result, Cmd, Modifiers, KeyCode, KeyEvent};
/// Minimal REPL
fn main() -> Result<()> {
env_logger::init();
let mut rl = DefaultEditor::new()?;
rl.bind_sequence(KeyEvent(KeyCode::BracketedPasteStart, Modifiers::NONE), Cmd::Noop);
loop {
let line = rl.readline("> ")?; // read
println!("Line: {line}"); // eval / print
} // loop
}
In this case, pasted content should be accepted line by line. But now only the first line accepted.
It's a similar problem as #690 but without difference.
rl.bind_sequence(KeyEvent(KeyCode::BracketedPasteStart, Modifiers::NONE), Cmd::Noop);
. https://github.com/kkawakam/rustyline/issues/480#issuecomment-759759109Sorry but your PR is fixing an edge case while impacting the common case.
@SalHe could you please try #761 ? Or just disable bracketed paster
@SalHe could you please try #761 ? Or just disable bracketed paster
Sorry for reply lately due to working stuff.
I have tried the latest rustyline
with feature buffer-redux
it does solve this problem. That's so great!
Thanks for your work.
https://github.com/SalHe/rustyline/blob/e001cab7a04c36f2a113ef465325feb4c0d77f7b/src/lib.rs#L707
RawReader
has been created and dropped when finishedreadline_edit
.BufReader
has capacity 1024, so it might read more thanreadline_edit
consumed (submitted when encouterred '\r').For example,
has been pasted. The buffer reads
"\033[220~1\r2\r\033[221~\000"
. When accepted '\r', command has been submitted.After this, we cannot retrieve rest of pasted command. So '2\r\033[221~\000' has been ignored.