| 1 |
# ANSI Escape sequences |
| 2 |
# Copyright (C) 2008 Masami Hiramatsu <[email protected]> |
| 3 |
# |
| 4 |
# This file is free software and is distributed under the terms of the GNU |
| 5 |
# General Public License (GPL); either version 2, or (at your option) any |
| 6 |
# later version. |
| 7 |
|
| 8 |
/* |
| 9 |
* cursor_move |
| 10 |
* |
| 11 |
* Move cursor to x-y position |
| 12 |
*/ |
| 13 |
function cursor_move(x:long, y:long) |
| 14 |
{ |
| 15 |
printf("\033[%d;%dH", y, x) |
| 16 |
} |
| 17 |
|
| 18 |
function cursor_cls() |
| 19 |
{ |
| 20 |
print("\033[1;1H\033[J") |
| 21 |
} |
| 22 |
|
| 23 |
function cursor_show() |
| 24 |
{ |
| 25 |
print("\033[>5h") |
| 26 |
} |
| 27 |
|
| 28 |
function cursor_hide() |
| 29 |
{ |
| 30 |
print("\033[>5I") |
| 31 |
} |
| 32 |
|
| 33 |
function cursor_save() |
| 34 |
{ |
| 35 |
print("\033[s") |
| 36 |
} |
| 37 |
|
| 38 |
function cursor_restore() |
| 39 |
{ |
| 40 |
print("\033[u") |
| 41 |
} |
| 42 |
|
| 43 |
function cursor_set_color(parm1:long) |
| 44 |
{ |
| 45 |
printf("\033[%dm", parm1) |
| 46 |
} |
| 47 |
function cursor_set_color2(parm1:long, parm2:long) |
| 48 |
{ |
| 49 |
printf("\033[%d;%dm", parm1, parm2) |
| 50 |
} |
| 51 |
function cursor_set_color3(parm1:long, parm2:long, parm3:long) |
| 52 |
{ |
| 53 |
printf("\033[%d;%d;%dm", parm1, parm2, parm3) |
| 54 |
} |
| 55 |
|
| 56 |
function cursor_reset_color() |
| 57 |
{ |
| 58 |
cursor_set_color2(0,0) |
| 59 |
} |
| 60 |
|