diff options
author | wm4 <wm4@nowhere> | 2014-08-21 22:11:38 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-08-21 22:45:58 +0200 |
commit | 47b29094c34bdf0aab9f213c8eb2347993e4d505 (patch) | |
tree | 3c68821d10cd713c6d515705b79d1513160bd494 /osdep/terminal-unix.c | |
parent | 218ace2b02e2f2a867c4b792d4a1ec03015d7294 (diff) | |
download | mpv-47b29094c34bdf0aab9f213c8eb2347993e4d505.tar.bz2 mpv-47b29094c34bdf0aab9f213c8eb2347993e4d505.tar.xz |
win32: emulate some ANSI terminal escape codes
We already redirect all terminal output through our own wrappers (for
the sake of UTF-8), so we might as well use it to handle ANSI escape
codes.
This also changes behavior on UNIX: we don't retrieve some escape codes
per terminfo anymore, and just hardcode them. Every terminal should
understand them.
The advantage is that we can pretend to have a real terminal in the
normal player code, and Windows atrocities are locked away in glue
code.
Diffstat (limited to 'osdep/terminal-unix.c')
-rw-r--r-- | osdep/terminal-unix.c | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/osdep/terminal-unix.c b/osdep/terminal-unix.c index 499ad73394..b17ede6670 100644 --- a/osdep/terminal-unix.c +++ b/osdep/terminal-unix.c @@ -54,8 +54,6 @@ static volatile int tio_orig_set; int screen_width = 80; int screen_height = 24; -char *terminal_erase_to_end_of_line = "\033[K"; -char *terminal_cursor_up = "\033[A"; typedef struct { char *cap; @@ -271,19 +269,11 @@ static int load_termcap(char *termtype){ static char term_buf[128]; char *buf_ptr = &term_buf[0]; - char *tmp; // References for terminfo/termcap codes: // http://linux.die.net/man/5/termcap // http://unixhelp.ed.ac.uk/CGI/man-cgi?terminfo+5 - tmp = tgetstr("ce", &buf_ptr); - if (tmp) - terminal_erase_to_end_of_line = tmp; - tmp = tgetstr("up", &buf_ptr); - if (tmp) - terminal_cursor_up = tmp; - screen_width = tgetnum("co"); screen_height = tgetnum("li"); if (screen_width < 1 || screen_width > 255) @@ -614,15 +604,6 @@ bool terminal_in_background(void) return isatty(2) && tcgetpgrp(2) != getpgrp(); } -void terminal_set_foreground_color(FILE *stream, int c) -{ - if (c == -1) { - fprintf(stream, "\033[0m"); - } else { - fprintf(stream, "\033[%d;3%dm", c >> 3, c & 7); - } -} - int terminal_init(void) { if (isatty(1)) |