Update to make work with new lines embedded in sent string. (#588)

* Update to make work with new lines embedded in sent string.

* Appease fmt
This commit is contained in:
WMR 2023-05-30 15:20:20 -07:00 committed by GitHub
parent f7515b40e5
commit 79778f7b85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -24,7 +24,9 @@ fn main() {
let mut i = 1;
loop {
sleep(Duration::from_secs(1));
assert!(p_clone.print(format!("Message {i} delivered.")).is_ok());
assert!(p_clone
.print(format!("Message {i} delivered.\nWith two lines!"))
.is_ok());
i += 1;
}
});

View File

@ -1669,7 +1669,8 @@ impl Reedline {
let result = external_printer.receiver().try_recv();
match result {
Ok(line) => {
messages.push(line);
let lines = line.lines().map(String::from).collect::<Vec<_>>();
messages.extend(lines);
}
Err(TryRecvError::Empty) => {
break;