Avoid clearing the buffer when Up arrow key is pressed and escCleanAllBuf is 1.