Mercurial > mplayer.hg
changeset 17258:3d02f6e2a432
change erase to end of line, fall back to old behavior if no termcap found
author | ods15 |
---|---|
date | Thu, 29 Dec 2005 11:27:22 +0000 |
parents | 1188874fd68b |
children | 94c995ede160 |
files | mplayer.c osdep/getch2-win.c osdep/getch2.c |
diffstat | 3 files changed, 11 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mplayer.c Wed Dec 28 12:34:20 2005 +0000 +++ b/mplayer.c Thu Dec 29 11:27:22 2005 +0000 @@ -962,8 +962,14 @@ saddf(line, &pos, width, "%4.2fx ", playback_speed); // end - line[pos] = 0; - mp_msg(MSGT_AVSYNC, MSGL_STATUS, "%s%s\r", erase_to_end_of_line, line); + if (erase_to_end_of_line) { + line[pos] = 0; + mp_msg(MSGT_AVSYNC, MSGL_STATUS, "%s%s\r", line, erase_to_end_of_line); + } else { + memset(&line[pos], ' ', width - pos); + line[width] = 0; + mp_msg(MSGT_AVSYNC, MSGL_STATUS, "%s\r", line); + } free(line); }
--- a/osdep/getch2-win.c Wed Dec 28 12:34:20 2005 +0000 +++ b/osdep/getch2-win.c Thu Dec 29 11:27:22 2005 +0000 @@ -22,7 +22,7 @@ int screen_width=80; int screen_height=24; -char * erase_to_end_of_line = " \r"; +char * erase_to_end_of_line = NULL; void get_screen_size(){ }
--- a/osdep/getch2.c Wed Dec 28 12:34:20 2005 +0000 +++ b/osdep/getch2.c Thu Dec 29 11:27:22 2005 +0000 @@ -40,7 +40,7 @@ int screen_width=80; int screen_height=24; -char * erase_to_end_of_line = "\033[J"; +char * erase_to_end_of_line = NULL; typedef struct { int len; @@ -79,7 +79,6 @@ 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); @@ -90,7 +89,7 @@ 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; + erase_to_end_of_line= tgetstr("cd",&term_p); termcap_add("kP",KEY_PGUP); termcap_add("kN",KEY_PGDWN);