1
1
use nu_ansi_term:: Color ;
2
2
use std:: {
3
- cmp:: Ordering ,
4
3
fmt:: { self , Write as _} ,
5
4
io,
6
5
} ;
@@ -12,14 +11,9 @@ use tracing_core::{
12
11
pub ( crate ) const LINE_VERT : & str = "│" ;
13
12
const LINE_HORIZ : & str = "─" ;
14
13
pub ( crate ) const LINE_BRANCH : & str = "├" ;
15
- pub ( crate ) const LINE_BRANCH_DOWN : & str = "┬" ;
16
14
pub ( crate ) const LINE_CLOSE : & str = "┘" ;
17
- pub ( crate ) const LINE_OPEN_DOWN : & str = "┌" ;
18
- pub ( crate ) const LINE_OPEN_UP : & str = "└" ;
19
15
pub ( crate ) const LINE_OPEN : & str = "┐" ;
20
16
21
- const LINE_DASH_VERT : & str = "┆" ;
22
-
23
17
#[ derive( Debug , Copy , Clone ) ]
24
18
pub ( crate ) enum SpanMode {
25
19
/// Executed on the parent before entering a child span
@@ -30,11 +24,6 @@ pub(crate) enum SpanMode {
30
24
Close {
31
25
verbose : bool ,
32
26
} ,
33
- /// Connects two disjoint levels of indentation together for the `pre_open` lines to connect
34
- RetraceBoundary {
35
- to : usize ,
36
- from : usize ,
37
- } ,
38
27
/// A span has been entered but another *different* span has been entered in the meantime.
39
28
Retrace {
40
29
verbose : bool ,
@@ -327,9 +316,6 @@ pub(crate) fn write_span_mode(buf: &mut String, style: SpanMode) {
327
316
SpanMode :: Close { verbose : true } => buf. push_str ( "close(v)" ) ,
328
317
SpanMode :: Close { verbose : false } => buf. push_str ( "close" ) ,
329
318
SpanMode :: PreOpen => buf. push_str ( "pre_open" ) ,
330
- SpanMode :: RetraceBoundary { to, from } => {
331
- write ! ( buf, "retrace_boundary({}:{})" , from, to) . unwrap ( )
332
- }
333
319
SpanMode :: PostClose => buf. push_str ( "post_close" ) ,
334
320
SpanMode :: Event => buf. push_str ( "event" ) ,
335
321
}
@@ -359,7 +345,6 @@ fn indent_block_with_lines(
359
345
SpanMode :: Open { .. } => buf. push_str ( LINE_OPEN ) ,
360
346
SpanMode :: Retrace { .. } => buf. push_str ( LINE_OPEN ) ,
361
347
SpanMode :: Close { .. } => buf. push_str ( LINE_CLOSE ) ,
362
- SpanMode :: RetraceBoundary { .. } => unreachable ! ( ) ,
363
348
SpanMode :: PreOpen { .. } | SpanMode :: PostClose => { }
364
349
SpanMode :: Event => { }
365
350
}
@@ -394,37 +379,6 @@ fn indent_block_with_lines(
394
379
}
395
380
buf. push_str ( LINE_OPEN ) ;
396
381
}
397
- // Print a divider connecting two diverged indents
398
- SpanMode :: RetraceBoundary { to, from } => {
399
- let write_line = |s : & mut String , len| {
400
- for _ in 0 ..len {
401
- s. push_str ( LINE_HORIZ ) ;
402
- }
403
- } ;
404
-
405
- match to. cmp ( & from) {
406
- // |
407
- // *--------*
408
- // |
409
- Ordering :: Less => {
410
- buf. push_str ( LINE_OPEN_DOWN ) ;
411
- write_line ( buf, ( from - to - 1 ) * indent_amount) ;
412
- buf. push_str ( LINE_CLOSE ) ;
413
- }
414
- // |
415
- // *
416
- // |
417
- Ordering :: Equal => buf. push_str ( LINE_DASH_VERT ) ,
418
- // |
419
- // *--------*
420
- // |
421
- Ordering :: Greater => {
422
- buf. push_str ( LINE_OPEN_UP ) ;
423
- write_line ( buf, to - from) ;
424
- buf. push_str ( LINE_OPEN ) ;
425
- }
426
- }
427
- }
428
382
SpanMode :: Open { verbose : false } | SpanMode :: Retrace { verbose : false } => {
429
383
buf. push_str ( LINE_BRANCH ) ;
430
384
for _ in 1 ..indent_amount {
@@ -533,7 +487,6 @@ fn indent_block(
533
487
SpanMode :: PreOpen | SpanMode :: PostClose => {
534
488
indent += 1 ;
535
489
}
536
- SpanMode :: RetraceBoundary { to, from } => indent = to. min ( from) ,
537
490
_ => ( ) ,
538
491
}
539
492
0 commit comments