Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows 7: ANSI code to clear the rest of the line gives additional characters: ←[K #37

Closed
kud1ing opened this issue Sep 14, 2018 · 11 comments

Comments

@kud1ing
Copy link

kud1ing commented Sep 14, 2018

On a German Windows cmd the output looks like this:

Collecting samples from 'pid: 17092' (python vX.Y.Z)←[K
Total Samples 598500←[K
GIL: 0.00%, Active: 200.00%, Threads: 2←[K
←[K
  %Own   %Total  OwnTime  TotalTime  Function (filename:line)
 99.40%  99.40%   572.4s    572.4s   run (foo.py:733)←[K[K
 84.10%  84.10%   109.4s    109.4s   foo (foo:4698)←[K
 11.50%  11.50%   13.13s    13.13s   foo (foo:4681)←[KK
  1.80%   1.80%    2.09s     2.09s   foo (foo:4676)←[KK
  0.90%   0.90%   0.791s    0.791s   foo (foo:4693)←[KK
  0.60%   0.60%   26.03s    26.03s   run (foo.py:728)←[K)←[KK
  0.40%   0.40%   0.555s    0.555s   foo (foo:4700)←[KK
  0.30%   0.30%   0.558s    0.558s   foo (foo:4694)←[KK2031)←[K
  0.30%   0.30%   0.508s    0.508s   foo (foo:4701)←[KK2031)←[K
  0.30%   0.30%   0.276s    0.276s   foo (foo:4695)←[KK2031)←[K
  0.20%   0.20%   0.043s    0.043s   foo (foo:4674)←[KK2031)←[K
  0.10%   0.10%   0.102s    0.102s   foo (foo:4691)←[K[K031)←[K
  0.10%   0.10%   0.035s    0.035s   foo (foo:4699)←[K[K031)←[K4)←[K
←[K
Press Control-C to quit, or ? for help.←[K
←[K
←[K

They seem to come from the macro out!:

() => (println!("\x1B[K")); // ANSI code to clear the rest of the line

@kud1ing kud1ing changed the title Strange additional characters before line breaks: ←[K Additional characters before line breaks: ←[K Sep 14, 2018
@kud1ing kud1ing changed the title Additional characters before line breaks: ←[K ANSI code to clear the rest of the line gives additional characters: ←[K Sep 14, 2018
@benfred
Copy link
Owner

benfred commented Sep 14, 2018

What version of windows are you running?

I tested on windows 10 (english) and using ANSI codes like this worked for me =(

@kud1ing
Copy link
Author

kud1ing commented Sep 14, 2018

Windows 7

@benfred benfred changed the title ANSI code to clear the rest of the line gives additional characters: ←[K Windows 7: ANSI code to clear the rest of the line gives additional characters: ←[K Sep 14, 2018
@benfred
Copy link
Owner

benfred commented Sep 14, 2018

Thanks for reporting this! I'll see if I can get a windows 7 box to replicate this on somehow.

@kud1ing
Copy link
Author

kud1ing commented Sep 15, 2018

Thanks.

@kud1ing
Copy link
Author

kud1ing commented Sep 15, 2018

I don't know much about Windows, but it seems that ANSI escape sequences were not supported before Win 10: https://stackoverflow.com/questions/16755142/how-to-make-win32-console-recognize-ansi-vt100-escape-sequences

@kud1ing
Copy link
Author

kud1ing commented Sep 15, 2018

I wonder whether there is a crate that does something like this correctly across platforms and operating system versions.

@benfred
Copy link
Owner

benfred commented Sep 17, 2018

I managed to reproduce this in a vagrant/virtualbox environment. This commit b32c494 seems to fix, will be in the next release.

thanks for reporting this!

@kud1ing
Copy link
Author

kud1ing commented Sep 18, 2018

Awesome, thank you.

@kud1ing kud1ing closed this as completed Sep 18, 2018
@kud1ing
Copy link
Author

kud1ing commented Sep 19, 2018

Do you have a plan when to release this?

@benfred
Copy link
Owner

benfred commented Sep 19, 2018

@kud1ing I just pushed 0.1.7 which should include this (windows wheels are generating on appveyor, should be pushed out in ~10 mins)

@kud1ing
Copy link
Author

kud1ing commented Sep 20, 2018

Works perfectly, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants