WSL: 'tput reset' (cls-like command) won't work

Related to: #1369 #1441 (and probably others)

  • Description: I usually define alias cls='tput reset' to get a unix equivalent for
  • Build number: 14393.447 (but apparently still not solved).
  • Steps to reproduce: just maximize the console window and execute tput reset
  • Expected result: the full screen scrollback clears (like cls in cmd.exe).
  • Actual result: interestingly, not only occurs what happens with just clear (like the other reports), but also the actual console window shrinks (smaller vertical size).

Notes: What tput reset does is similar to the related bugs: it prints an escape code (obtained from terminfo database). In particular, you can get the same result with: echo -e '\033c\033[!p\033[?3;4l\033[4l\033>' This escape code was extracted by this little trick: tput reset | sed -n l

Trying with another TERM produces similar results: TERM=rxvt tput reset.

Additional info: https://www.gnu.org/software/termutils/manual/termutils-2.0/html_chapter/tput_1.html

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 18 (1 by maintainers)

Most upvoted comments

@japm48 @fpqc Thanks for shedding light on this. Yes, I implemented CSI ? 3 h/l correctly, initially because we were using vttest to judge our terminal capabilities, and that’s what it uses to clear the screen and setup (IIRC).

This is just one of many cases where the actual behavior of the terminal does not directly match any of the previous specs I read, but instead was documented in another previously unknown spec. I’ll make a bug (MSFT:10065277) number for tracking and disabling this by default.

Yes, ESC c is not implemented at the time, I might be able to slip that in with fixing this though.