mirror of
https://github.com/mpv-player/mpv
synced 2025-05-05 01:30:42 +00:00
change erase to end of line, fall back to old behavior if no termcap found
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17259 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
8ae9b08191
commit
eaee93051a
@ -962,8 +962,14 @@ 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
|
||||||
|
if (erase_to_end_of_line) {
|
||||||
line[pos] = 0;
|
line[pos] = 0;
|
||||||
mp_msg(MSGT_AVSYNC, MSGL_STATUS, "%s%s\r", erase_to_end_of_line, line);
|
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);
|
free(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ int mp_input_win32_slave_cmd_func(int fd,char* dest,int size){
|
|||||||
|
|
||||||
int screen_width=80;
|
int screen_width=80;
|
||||||
int screen_height=24;
|
int screen_height=24;
|
||||||
char * erase_to_end_of_line = " \r";
|
char * erase_to_end_of_line = NULL;
|
||||||
|
|
||||||
void get_screen_size(){
|
void get_screen_size(){
|
||||||
}
|
}
|
||||||
|
@ -40,7 +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";
|
char * erase_to_end_of_line = NULL;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int len;
|
int len;
|
||||||
@ -79,7 +79,6 @@ 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);
|
||||||
@ -90,7 +89,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;
|
erase_to_end_of_line= tgetstr("cd",&term_p);
|
||||||
|
|
||||||
termcap_add("kP",KEY_PGUP);
|
termcap_add("kP",KEY_PGUP);
|
||||||
termcap_add("kN",KEY_PGDWN);
|
termcap_add("kN",KEY_PGDWN);
|
||||||
|
Loading…
Reference in New Issue
Block a user