#Edit a printed line

10 messages · Page 1 of 1 (latest)

small venture
#

This depends on your terminal. A cross-platform crate for this is crossterm.

Alternatively, you can try to print \x7F (decimal 127, the ASCII Backspace character). On some terminals, this causes the cursor to go back (but doesn't actually delete the printed text, you need to print over it to do that. Using a whitespace will do)

#

print!, don't println!

#

\x7F deletes one character, you need to do it more to delete the whole line

#

(assuming it even works on your terminal)

#

Printing \r may also work for "go to start of line"

#

Then crossterm it is I guess

#

?crate crossterm

fluid plinthBOT
#

A crossplatform terminal library for manipulating terminals.

Version

0.25.0

Downloads

4 946 686

small venture
#

They're not functions, they're structs