|
Re: Options to control the cursor on the terminal without using ncurses lib?
|
01/15/2010 9:26 AM
post45292
|
Re: Options to control the cursor on the terminal without using ncurses lib?
Hi Sven,
to position the cursor, issue
CSI [ <row> [ ';' <col> ] ] 'H'
where CSI is either ESC followed by '[' or 0x9B (in 8-bit-mode).
E.g., on the command line, do
printf '\x1b[H%s' Hello
to print 'Hello' at row 0, column 0,
printf '\x1b[%dH%s' 11 Hello
to print 'Hello' at row 11, column 0, and
printf '\x1b[%d;%dH%s' 11 22 Hello
to print 'Hello' at row 11, column 22.
Reading the position has never really worked for me. What you can do, however, is to save and restore the cursor
position.
To save, issue
CSI s
to restore, use
CSI u
- Thomas
|
|
|