meganz / MEGAcmd

Command Line Interactive and Scriptable Application to access MEGA
Other
1.92k stars 406 forks source link

[Bug] clear does not clear the screen #166

Open jneidel opened 5 years ago

jneidel commented 5 years ago

clear does not work like the bash equivalent for me:

<my-email>:/$ clear                                                                                                                      

<my-email>:/$ 

There is a whole lot of spaces, but no line breaks.

And neither does ctrl + l (clear shortcut):

<my-email>:/$ [^L]
<my-email>:/$
polmr commented 5 years ago

Hi @jneidel ! what is your OS and MEGAcmd version (version). We have detected that in some installations this isn't working properly. Still trying to figure out the cause for this line (https://github.com/meganz/MEGAcmd/blob/master/src/megacmdshell/megacmdshell.cpp#L1644) behaving differently. Thanks for reporting that!

jneidel commented 5 years ago

Hey @polmr, here the requested data:

OS: Manjaro 18.0.2 Illyria

mega-version: MEGA CMD version: 1.0.0: code 1000000

Installed AUR package

ghost commented 5 years ago

Perhaps it might be solved using

printf("\033[H\033[J");

It is an ANSI/VT100 terminal control escape sequence (http://www.termsys.demon.co.uk/vtansi.htm) and it should work in all GNU/LINUX terminals.

polmr commented 5 years ago

@cjrocks proposed solution works like a charm. It'll be included in the next release. Thanks!