I'm writing a program with Ada, and it reads inputted numerical characters one character a time. I'm trying to simulate a backspace button, but I can't figure out a way to overwrite or remove a character that's already been placed on the screen.
I am aware that put(ASCII.ESC & "[J") can clear the screen, but I'm not sure how it works or if it can be manipulated to delete a single character or line. I basically want to create something that can function as a backspace button, but I'm really not sure how to go about doing this in Ada. I cannot find much documentation online for this sort of thing.
Any advice would be appreciated. Here is a snippet of my code:
loop
get_immediate(buffer);
exit when buffer = LF;
--Using dash as a backspace key
if (buffer = '-') then
put(ASCII.ESC & "[J");
--Print to terminal if the character is numeric
elsif (buffer >= '0' and buffer <= '9') then
put(buffer);
end if;
end loop;