File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,7 @@ impl NBReader {
136
136
thread:: spawn ( move || -> Result < ( ) , Error > {
137
137
let mut reader = BufReader :: new ( f) ;
138
138
let mut byte = [ 0u8 ] ;
139
+ let mut in_escape_code = false ;
139
140
140
141
loop {
141
142
match reader. read ( & mut byte) {
@@ -146,10 +147,10 @@ impl NBReader {
146
147
}
147
148
Ok ( _) => {
148
149
if options. strip_ansi_escape_codes && byte[ 0 ] == 27 {
149
- while let Ok ( _ ) = reader . read ( & mut byte ) {
150
- if char :: from ( byte [ 0 ] ) . is_alphabetic ( ) {
151
- break ;
152
- }
150
+ in_escape_code = true ;
151
+ } else if options . strip_ansi_escape_codes && in_escape_code {
152
+ if char :: from ( byte [ 0 ] ) . is_alphabetic ( ) {
153
+ in_escape_code = false ;
153
154
}
154
155
} else {
155
156
tx. send ( Ok ( PipedChar :: Char ( byte[ 0 ] ) ) )
You can’t perform that action at this time.
0 commit comments