Clear button not working

For some reason my console wont clear the run after the code stops working as well as it will sometime create a new run right in a separate “tab” in the console anyone know how to fix this?

Hi @IsraelGarcia19 , welcome to the forums!
This is a new feature that Replit has released. To clear the previous history of runs, press the Trash icon at the top of the Console tab.
Hope this helps!

1 Like

You can also collapse each run down to its last line by toggling its expand/collapse arrow.
collapsearrows
gif

This can be useful in the scenario where you need to revert any changes you’ve made, as you’ll have an output/error log to go with your file’s history.

Or you can clear the history with the Trashcan icon

There’s a few different options, so whichever one is easiest for you

Clicking on console brings down a search actions window where you can clear the history:
image
you can also search “clear history” but it’s the first option by default so you don’t really need to:
image

You can click on the 3 dots which are the window / pane’s settings:

… and then under console you have clear history :

You can also click the 3 dots in the console pane and in the search bar, type clear history



image

If you use macros you could also assign a macro to handle this for you.
On my mouse I’ve created a macro with the following keystrokes :

(ctrl+j)clear(space)history(enter)

ctrl+j is the default for opening the pane’s settings. then in the search bar there it types in “clear(space)history” and hits enter.

Now I assign the macro to my mouse and I can clear the console history just by pressing one button, as long as the console is the active window/pane.
Here’s how it looks in action :
macro

Alternatively, you can use the Shell tab to have old-console clearing methods.

1 Like

I tried typing console - clear into the shell and it gave me :


I tried running both of them but then still couldn’t figure out how to clear it from there.

No, as in run the file using python file.py and click the Trash icon to clear everything.

console-clear was never a command to clear the console.

Instead type clear.

2 Likes

I was trying to clear the code output from the current session in the console with the shell , not just clear the shell.
Just for the sake of doing it in some other way :smile:

Then what programming language are you using?

I predominantly work with Python for my programming needs, but I maintain a versatile approach, utilizing the command line prompt or any other suitable tools as the situation requires.

Then use this code:

print(end="\033c")

any time you want to clear.

Better yet, make a function:

def clear():
    print(end="\033c")
2 Likes

I had tried similar print commands but to no avail.

The one you’ve provided seems to (I’m assuming) hide the output rather than actually clear it. If I choose to collapse the run I still see the final line of the output.

My goal is to clear the entire console output history (all the past runs) with a shell command but a print command in main.py would satisfy my wants as well.

And again this is just for fun, I don’t really NEED it for anything. Just trying to figure stuff out

Regardless I appreciate the help.

And I apologize for any unclear or misused terminology causing confusion. I’ve only been learning for about a month and a half now.

Ah well it would clear properly if I had included , flush=True in the print statement:

def clear():
    print(end="\033c", flush=True)

That’s not possible with this new Console layout afaIk.

4 Likes

i’ve tried clicking on the trash button but even so it doesn’t clear anything up.

Hi @IsraelGarcia19 ! If you could use Loom or another recording software to shoot a video and/or send related screenshots, we would be able assist you to the best of our abilities.

1 Like

Have you stopped running your repl before you try to clear it?
If it’s still running you can’t clear that current run from the history.
Or are you saying that none of the past runs are clearing? :thinking:

Sorry if this isn’t related to your issue.