Support escape sequences used by 'ls --color=auto'

This commit is contained in:
Norman Feske 2012-03-21 21:24:25 +01:00
parent afeb54ebed
commit 724a6e8120
1 changed files with 14 additions and 1 deletions

View File

@ -329,7 +329,20 @@ namespace Terminal {
case 'H': return (_screen.cup(p1, p2), true);
case 'm':
if ((p1 == 39) && (p2 == 49)) return (_screen.op(), true);
if ((p1 == 0) && (p2 == 10)) return (_screen.sgr(0), true);
if ((p1 == 0 || p1 == 1) && (p2 >= 30) && (p2 <= 37)) {
/*
* p1 encodes attribute (see 'dircolors -p')
* 0 -> normal
* 1 -> bold (turn into highlight)
*
* p2 encodes color
* 30...37 text colors
* 40...47 background colors
*/
_screen.sgr(p1);
_screen.setaf(p2 - 30);
return true;
}
return false;
case 'R': return (_screen.u6(p1, p2), true);
default: return false;