diff options
author | james <> | 2008-02-04 05:45:55 +0000 |
---|---|---|
committer | james <> | 2008-02-04 05:45:55 +0000 |
commit | 8865ddf602b32113af2899c5ef1046c51aeb972c (patch) | |
tree | 3b90eae60b7fa863499d8a3ec7befd94e246ffcb /src/ansi.c | |
parent | c4b7eff58a98590defd94bdbd39a7798521b55a1 (diff) | |
download | sympathy-8865ddf602b32113af2899c5ef1046c51aeb972c.tar.gz sympathy-8865ddf602b32113af2899c5ef1046c51aeb972c.tar.bz2 sympathy-8865ddf602b32113af2899c5ef1046c51aeb972c.zip |
::
Diffstat (limited to 'src/ansi.c')
-rw-r--r-- | src/ansi.c | 28 |
1 files changed, 23 insertions, 5 deletions
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$"; /* * $Log$ + * Revision 1.3 2008/02/04 05:45:55 james + * :: + * * Revision 1.2 2008/02/04 02:05:06 james * *** empty log message *** * @@ -25,6 +28,19 @@ ansi_write (ANSI * a, char *buf, int n) write (a->fd, buf, n); } +void +ansi_getsize(ANSI *a) +{ +struct winsize sz={0}; +if (ioctl(a->fd,TIOCGWINSZ,&sz)) { + a->size.x=CRT_COLS; + a->size.y=CRT_ROWS; +} else { + a->size.x=sz.ws_col; + a->size.y=sz.ws_row; +} + +} void @@ -102,13 +118,13 @@ ansi_move (ANSI * a, CRT_Pos p) } else { - n = snprintf (buf, sizeof (buf), "\033[%d;%dHF", p.y + 1, p.x + 1); + n = snprintf (buf, sizeof (buf), "\033[%d;%dH", p.y + 1, p.x + 1); ansi_write (a, buf, n); } } else { - n = snprintf (buf, sizeof (buf), "\033[%d;%dHF", p.y + 1, p.x + 1); + n = snprintf (buf, sizeof (buf), "\033[%d;%dH", p.y + 1, p.x + 1); ansi_write (a, buf, n); } @@ -124,11 +140,11 @@ ansi_showhide_cursor (ANSI * a, int hide) if (hide) { - ansi_write (a, "\033[?25h", 6); + ansi_write (a, "\033[?25l", 6); } else { - ansi_write (a, "\033[?25l", 6); + ansi_write (a, "\033[?25h", 6); } a->hide_cursor = hide; @@ -269,7 +285,9 @@ ansi_draw (ANSI * a, CRT * c) void ansi_reset (ANSI * a) { - ansi_write (a, "\033[c", 3); +// FIXME: -- echos back crap? +// ansi_write (a, "\033[c", 3); + ansi_getsize(a); a->pos.x = ANSI_INVAL; a->hide_cursor = ANSI_INVAL; |