Terminal control/Cursor movement: Difference between revisions
Content added Content deleted
(Add BaCon) |
(Added Wren) |
||
Line 1,042: | Line 1,042: | ||
tput hpa $WIDTH # end of line |
tput hpa $WIDTH # end of line |
||
tput cup $HEIGHT $WIDTH # bottom right corner</lang> |
tput cup $HEIGHT $WIDTH # bottom right corner</lang> |
||
=={{header|Wren}}== |
|||
<lang ecmascript>import "timer" for Timer |
|||
import "io" for Stdout |
|||
var esc = "\x1b" |
|||
System.write("%(esc)[2J") // clear terminal |
|||
System.write("%(esc)[12;40H") // move to (12, 40) |
|||
Stdout.flush() |
|||
Timer.sleep(2000) |
|||
System.write("%(esc)[D") // move left |
|||
Stdout.flush() |
|||
Timer.sleep(2000) |
|||
System.write("%(esc)[C") // move right |
|||
Stdout.flush() |
|||
Timer.sleep(2000) |
|||
System.write("%(esc)[A") // move up |
|||
Stdout.flush() |
|||
Timer.sleep(2000) |
|||
System.write("%(esc)[B") // move down |
|||
Stdout.flush() |
|||
Timer.sleep(2000) |
|||
System.write("%(esc)[G") // move to beginning of line |
|||
Stdout.flush() |
|||
Timer.sleep(2000) |
|||
System.write("%(esc)[79C") // move to end of line (assuming 80 column terminal) |
|||
Stdout.flush() |
|||
Timer.sleep(2000) |
|||
System.write("%(esc)[1;1H") // move to top left corner |
|||
Stdout.flush() |
|||
Timer.sleep(2000) |
|||
System.write("%(esc)[24;80H") // move to bottom right corner (assuming 80 x 24 terminal) |
|||
Stdout.flush() |
|||
Timer.sleep(2000) |
|||
System.write("%(esc)[1;1H") // home cursor again before quitting</lang> |
|||
=={{header|XPL0}}== |
=={{header|XPL0}}== |