Wrap the ANSI control sequence by separate macros "INIT_CURSOR" and "EMPTY_SCREEN" in "clear" function.
Correct the error in "clear" function
Correct the error in "clear" function