File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ protected function convertAnsiToColor($ansi)
9999 if ('0 ' != $ ansi && '' != $ ansi ) {
100100 $ options = explode ('; ' , $ ansi );
101101
102- foreach ($ options as $ option ) {
102+ foreach ($ options as $ key => $ option ) {
103103 if ($ option >= 30 && $ option < 38 ) {
104104 $ fg = $ option - 30 ;
105105 } elseif ($ option >= 40 && $ option < 48 ) {
@@ -108,6 +108,22 @@ protected function convertAnsiToColor($ansi)
108108 $ fg = 7 ;
109109 } elseif (49 == $ option ) {
110110 $ bg = 0 ;
111+ } elseif ($ option >= 22 && $ option < 30 ) { // 21 has varying effects, best to ignored it
112+ $ unset = $ option - 20 ;
113+
114+ foreach ($ options as $ i => $ v ) {
115+ if ($ v == $ unset ) {
116+ unset($ options [$ i ]);
117+ }
118+
119+ if (2 == $ unset && 1 == $ v ) { // 22 also unsets bold
120+ unset($ options [$ i ]);
121+ }
122+
123+ if ($ i >= $ key ) { // do not unset options after current position in parent loop
124+ break ;
125+ }
126+ }
111127 }
112128 }
113129
You can’t perform that action at this time.
0 commit comments