Garry Pettet
Garry Pettet

Reputation: 8288

How Do You Clear the macOS Terminal Pad In Visual Studio For Mac?

I'm debugging a C# console application using Visual Studio for the Mac. I'm using frequent Console.WriteLine() statements.

Is there anyway to clear the output of the Terminal - macOS pad where the Console output is displayed every time I run / debug the program? I've tried calls to Console.Clear() to no effect. I have seen suggestions to use Cmd-K but that doesn't work. Other suggestions are all for VSCode, not Visual Studio.

enter image description here

Surely I can't be the only one who finds seeing the old output distracting when debugging?

Upvotes: 11

Views: 2750

Answers (6)

Paiman Roointan
Paiman Roointan

Reputation: 574

Use this as a workaround:

Console.Write("\f\u001bc\x1b[3J");

replace Console.Clear() with the above

Upvotes: 0

Jack Neale
Jack Neale

Reputation: 1

I came here looking for the solution as I couldn't figure it out for the life of me, tried 'cmd + k' and it worked. I could have sworn I'd tried it in the past with no success. Maybe a few points that will help:

  • Have the terminal selected.
  • The terminal line has to empty.

New to coding, first stack overflow comment, hope this has some value.

Upvotes: -1

Kien Vu
Kien Vu

Reputation: 1048

I call Console.Clear() at first line each time Run project

Upvotes: -1

Taisbak
Taisbak

Reputation: 127

Close the terminal window, then the next run will open an empty one.

Upvotes: -1

FreshStart
FreshStart

Reputation: 13

You may deactivate and reactivate the integrated terminal in : preferences\terminal options\uncheck\check. You may have to close VSFM between the uncheck\check process in order to clear the entre data. That way, it does clear the terminal data, but I would prefer some fast “clear” kind of short-cut options instead.

Have a good one.

Prog

Upvotes: 0

LJ2010
LJ2010

Reputation: 136

You aren't alone. I was just wondering why it didn't clear the screen either. There is an option to use Terminal, instead of the built in terminal. Check under Preferences > Terminal, then remove the check mark next to "Enable Integrated Terminal" and it will just pop up in a normal terminal which doesn't seem to have that issue. If you figure something else out let me know though.

Upvotes: 11

Related Questions