1
mirror of https://github.com/mpv-player/mpv synced 2025-01-13 00:06:25 +01:00

Use termcap "erase to end of line" character code instead of using spaces

to end of screen.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17241 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
ods15 2005-12-25 18:26:35 +00:00
parent c1211b4370
commit 95db0aeb23
3 changed files with 8 additions and 3 deletions

View File

@ -962,9 +962,8 @@ static void print_status(float a_pos, float a_v, float corr)
saddf(line, &pos, width, "%4.2fx ", playback_speed); saddf(line, &pos, width, "%4.2fx ", playback_speed);
// end // end
memset(&line[pos], ' ', width - pos); line[pos] = 0;
line[width] = 0; mp_msg(MSGT_AVSYNC, MSGL_STATUS, "%s%s\r", line, erase_to_end_of_line);
mp_msg(MSGT_AVSYNC, MSGL_STATUS, "%s\r", line);
free(line); free(line);
} }

View File

@ -40,6 +40,7 @@ static char getch2_buf[BUF_LEN];
int screen_width=80; int screen_width=80;
int screen_height=24; int screen_height=24;
char * erase_to_end_of_line = "\033[J";
typedef struct { typedef struct {
int len; int len;
@ -78,6 +79,7 @@ char *p=tgetstr(id,&term_p);
static int success=0; static int success=0;
int load_termcap(char *termtype){ int load_termcap(char *termtype){
char * p;
if(!termtype) termtype=getenv("TERM"); if(!termtype) termtype=getenv("TERM");
if(!termtype) termtype="unknown"; if(!termtype) termtype="unknown";
success=tgetent(term_buffer, termtype); success=tgetent(term_buffer, termtype);
@ -88,6 +90,7 @@ int load_termcap(char *termtype){
screen_height=tgetnum("li"); screen_height=tgetnum("li");
if(screen_width<1 || screen_width>255) screen_width=80; if(screen_width<1 || screen_width>255) screen_width=80;
if(screen_height<1 || screen_height>255) screen_height=24; if(screen_height<1 || screen_height>255) screen_height=24;
if ((p = tgetstr("cd",&term_p))) erase_to_end_of_line=p;
termcap_add("kP",KEY_PGUP); termcap_add("kP",KEY_PGUP);
termcap_add("kN",KEY_PGDWN); termcap_add("kN",KEY_PGDWN);

View File

@ -5,6 +5,9 @@
extern int screen_width; extern int screen_width;
extern int screen_height; extern int screen_height;
/* Termcap code to erase to end of line */
extern char * erase_to_end_of_line;
/* Get screen-size using IOCTL call. */ /* Get screen-size using IOCTL call. */
extern void get_screen_size(); extern void get_screen_size();