kurtlawrence / papyrus

(Rust) repl
MIT License
440 stars 14 forks source link

println!() does not carriage return on linux #53

Closed kurtlawrence closed 4 years ago

kurtlawrence commented 4 years ago

Running the following. Does not carriage return with the println!(). Behaviour does not replicate on windows.

[lib] papyrus=> for i in 0..10 { println!("{}", i); }
0
 1
  2
   3
    4
     5
      6
       7
        8
         9
papyrus [out0]: ()
kurtlawrence commented 4 years ago

The behaviour can be rectified by disabling raw mode (https://docs.rs/crossterm/0.14.1/crossterm/terminal/fn.disable_raw_mode.html), running the evalution, then re-enabling raw mode (https://docs.rs/crossterm/0.14.1/crossterm/terminal/fn.enable_raw_mode.html).

There is also a small issue with linux printing/not erasing last line when a read line overflows which can be fixed on this commit