1
mirror of https://github.com/mpv-player/mpv synced 2024-12-24 07:33:46 +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);
// end
memset(&line[pos], ' ', width - pos);
line[width] = 0;
mp_msg(MSGT_AVSYNC, MSGL_STATUS, "%s\r", line);
line[pos] = 0;
mp_msg(MSGT_AVSYNC, MSGL_STATUS, "%s%s\r", line, erase_to_end_of_line);
free(line);
}

View File

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

View File

@ -5,6 +5,9 @@
extern int screen_width;
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. */
extern void get_screen_size();