You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a simple program in Rust that prints a prompt, reads a string, and prints it.
read1line.rs
use std::io::{self, BufRead};
use std::io::Write;
fn main() {
print!("prompt>");
let _ = io::stdout().lock().flush();
let stdin = io::stdin();
let line = stdin.lock().lines().next().unwrap().unwrap();
println!("{}",line);
}
When I run the program in terminal and enter line 123, I get the result:
->rustc read1line.rs
->./read1line
prompt>123
123
The result of running in terminal on MacOS with rlwrap:
->uname -v
Darwin Kernel Version 22.3.0: Mon Jan 30 20:42:11 PST 2023; root:xnu-8792.81.3~2/RELEASE_X86_64
->rlwrap ./rea1line
prompt>123 123
123
The result of running in terminal on Ubuntu with rlwrap:
->uname -av
Linux serhii-desktop 5.15.0-47-generic #51-Ubuntu SMP Thu Aug 11 07:51:15 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
->rlwrap ./read1line
123
123
On Linux, the prompt disappears, and on MacOS, there is an extra text as long as the prompt.
The text was updated successfully, but these errors were encountered:
Because rlwrap has to rely on undocumented (and changing) readline behaviour (like the positioning of the cursor right after accepting a line) there have been some problems with bracketed paste mode (which have become much more widespread after readline started enabling this mode by default)
Your Ubuntu problem is a duplicate of #108, your MacOS problem is a duplicate of #168.
To avoid problems, either use the newest readline and rlwrap, or disabe bracketed-paste by putting ...
I have a simple program in Rust that prints a prompt, reads a string, and prints it.
read1line.rs
When I run the program in terminal and enter line 123, I get the result:
The result of running in terminal on MacOS with rlwrap:
The result of running in terminal on Ubuntu with rlwrap:
On Linux, the prompt disappears, and on MacOS, there is an extra text as long as the prompt.
The text was updated successfully, but these errors were encountered: