qryxip / cargo-compete

A Cargo subcommand for competitive programming
Apache License 2.0
265 stars 32 forks source link

Output of `cargo compete open` is cleared in Windows Terminal #163

Open estshorter opened 3 years ago

estshorter commented 3 years ago

It seems that the terminal is cleared after printing message when using Windows Terminal.

example

How to reproduce

cargo new practice  # platform=atcoder
cd practice
cargo compete open

Note: This works flawlessly in a terminal of VS Code.

Expected output:

$ cargo compete open    
     Opening https://atcoder.jp/contests/practice/tasks/practice_1
     Opening https://atcoder.jp/contests/practice/tasks/practice_2

Environment

OS: Ubuntu 20.04.3 on Windows10 21H1 (WSL2) Windows Terminal: 1.10.2383.0 cargo-compete: 0.9.0

estshorter commented 3 years ago

P.S. I haven't checked detail yet, but echo 65001 > ~/.config/wslu/oemcp solved this issue. It seems that changing the encoding causes a terminal reset. Ref: https://github.com/wslutilities/wslu/issues/199

https://github.com/qryxip/cargo-compete/blob/8a148d94f61d6bc39bf65ce995476386546ec633/src/open.rs#L20