@@ -67,7 +67,7 @@ pub const DEFAULT_TERM_WIDTH: usize = 140;
67
67
pub struct Renderer {
68
68
anonymized_line_numbers : bool ,
69
69
term_width : usize ,
70
- theme : OutputTheme ,
70
+ theme : DecorStyle ,
71
71
stylesheet : Stylesheet ,
72
72
short_message : bool ,
73
73
}
@@ -78,7 +78,7 @@ impl Renderer {
78
78
Self {
79
79
anonymized_line_numbers : false ,
80
80
term_width : DEFAULT_TERM_WIDTH ,
81
- theme : OutputTheme :: Ascii ,
81
+ theme : DecorStyle :: Ascii ,
82
82
stylesheet : Stylesheet :: plain ( ) ,
83
83
short_message : false ,
84
84
}
@@ -153,7 +153,7 @@ impl Renderer {
153
153
self
154
154
}
155
155
156
- pub const fn theme ( mut self , output_theme : OutputTheme ) -> Self {
156
+ pub const fn theme ( mut self , output_theme : DecorStyle ) -> Self {
157
157
self . theme = output_theme;
158
158
self
159
159
}
@@ -606,7 +606,7 @@ impl Renderer {
606
606
buffer. append ( buffer_msg_line_offset + i, & padding, ElementStyle :: NoStyle ) ;
607
607
if title_style == TitleStyle :: Secondary
608
608
&& is_cont
609
- && matches ! ( self . theme, OutputTheme :: Unicode )
609
+ && matches ! ( self . theme, DecorStyle :: Unicode )
610
610
{
611
611
// There's another note after this one, associated to the subwindow above.
612
612
// We write additional vertical lines to join them:
@@ -765,7 +765,7 @@ impl Renderer {
765
765
} else {
766
766
let buffer_msg_line_offset = buffer. num_lines ( ) ;
767
767
if is_primary {
768
- if self . theme == OutputTheme :: Unicode {
768
+ if self . theme == DecorStyle :: Unicode {
769
769
buffer. puts (
770
770
buffer_msg_line_offset,
771
771
max_line_num_len,
@@ -2331,29 +2331,27 @@ impl Renderer {
2331
2331
style : ElementStyle ,
2332
2332
) {
2333
2333
let chr = match ( style, self . theme ) {
2334
- ( ElementStyle :: UnderlinePrimary | ElementStyle :: LabelPrimary , OutputTheme :: Ascii ) => {
2335
- '|'
2336
- }
2337
- ( _, OutputTheme :: Ascii ) => '|' ,
2338
- ( ElementStyle :: UnderlinePrimary | ElementStyle :: LabelPrimary , OutputTheme :: Unicode ) => {
2334
+ ( ElementStyle :: UnderlinePrimary | ElementStyle :: LabelPrimary , DecorStyle :: Ascii ) => '|' ,
2335
+ ( _, DecorStyle :: Ascii ) => '|' ,
2336
+ ( ElementStyle :: UnderlinePrimary | ElementStyle :: LabelPrimary , DecorStyle :: Unicode ) => {
2339
2337
'┃'
2340
2338
}
2341
- ( _, OutputTheme :: Unicode ) => '│' ,
2339
+ ( _, DecorStyle :: Unicode ) => '│' ,
2342
2340
} ;
2343
2341
buffer. putc ( line, offset + depth - 1 , chr, style) ;
2344
2342
}
2345
2343
2346
2344
fn col_separator ( & self ) -> char {
2347
2345
match self . theme {
2348
- OutputTheme :: Ascii => '|' ,
2349
- OutputTheme :: Unicode => '│' ,
2346
+ DecorStyle :: Ascii => '|' ,
2347
+ DecorStyle :: Unicode => '│' ,
2350
2348
}
2351
2349
}
2352
2350
2353
2351
fn multi_suggestion_separator ( & self ) -> & ' static str {
2354
2352
match self . theme {
2355
- OutputTheme :: Ascii => "|" ,
2356
- OutputTheme :: Unicode => "├╴" ,
2353
+ DecorStyle :: Ascii => "|" ,
2354
+ DecorStyle :: Unicode => "├╴" ,
2357
2355
}
2358
2356
}
2359
2357
@@ -2375,7 +2373,7 @@ impl Renderer {
2375
2373
2376
2374
fn draw_col_separator_start ( & self , buffer : & mut StyledBuffer , line : usize , col : usize ) {
2377
2375
match self . theme {
2378
- OutputTheme :: Ascii => {
2376
+ DecorStyle :: Ascii => {
2379
2377
self . draw_col_separator_no_space_with_style (
2380
2378
buffer,
2381
2379
'|' ,
@@ -2384,7 +2382,7 @@ impl Renderer {
2384
2382
ElementStyle :: LineNumber ,
2385
2383
) ;
2386
2384
}
2387
- OutputTheme :: Unicode => {
2385
+ DecorStyle :: Unicode => {
2388
2386
self . draw_col_separator_no_space_with_style (
2389
2387
buffer,
2390
2388
'╭' ,
@@ -2405,7 +2403,7 @@ impl Renderer {
2405
2403
2406
2404
fn draw_col_separator_end ( & self , buffer : & mut StyledBuffer , line : usize , col : usize ) {
2407
2405
match self . theme {
2408
- OutputTheme :: Ascii => {
2406
+ DecorStyle :: Ascii => {
2409
2407
self . draw_col_separator_no_space_with_style (
2410
2408
buffer,
2411
2409
'|' ,
@@ -2414,7 +2412,7 @@ impl Renderer {
2414
2412
ElementStyle :: LineNumber ,
2415
2413
) ;
2416
2414
}
2417
- OutputTheme :: Unicode => {
2415
+ DecorStyle :: Unicode => {
2418
2416
self . draw_col_separator_no_space_with_style (
2419
2417
buffer,
2420
2418
'╰' ,
@@ -2457,16 +2455,16 @@ impl Renderer {
2457
2455
2458
2456
fn file_start ( & self , is_first : bool ) -> & ' static str {
2459
2457
match self . theme {
2460
- OutputTheme :: Ascii => "--> " ,
2461
- OutputTheme :: Unicode if is_first => " ╭▸ " ,
2462
- OutputTheme :: Unicode => " ├▸ " ,
2458
+ DecorStyle :: Ascii => "--> " ,
2459
+ DecorStyle :: Unicode if is_first => " ╭▸ " ,
2460
+ DecorStyle :: Unicode => " ├▸ " ,
2463
2461
}
2464
2462
}
2465
2463
2466
2464
fn secondary_file_start ( & self ) -> & ' static str {
2467
2465
match self . theme {
2468
- OutputTheme :: Ascii => "::: " ,
2469
- OutputTheme :: Unicode => " ⸬ " ,
2466
+ DecorStyle :: Ascii => "::: " ,
2467
+ DecorStyle :: Unicode => " ⸬ " ,
2470
2468
}
2471
2469
}
2472
2470
@@ -2478,32 +2476,32 @@ impl Renderer {
2478
2476
is_cont : bool ,
2479
2477
) {
2480
2478
let chr = match self . theme {
2481
- OutputTheme :: Ascii => "= " ,
2482
- OutputTheme :: Unicode if is_cont => "├ " ,
2483
- OutputTheme :: Unicode => "╰ " ,
2479
+ DecorStyle :: Ascii => "= " ,
2480
+ DecorStyle :: Unicode if is_cont => "├ " ,
2481
+ DecorStyle :: Unicode => "╰ " ,
2484
2482
} ;
2485
2483
buffer. puts ( line, col, chr, ElementStyle :: LineNumber ) ;
2486
2484
}
2487
2485
2488
2486
fn diff ( & self ) -> char {
2489
2487
match self . theme {
2490
- OutputTheme :: Ascii => '~' ,
2491
- OutputTheme :: Unicode => '±' ,
2488
+ DecorStyle :: Ascii => '~' ,
2489
+ DecorStyle :: Unicode => '±' ,
2492
2490
}
2493
2491
}
2494
2492
2495
2493
fn draw_line_separator ( & self , buffer : & mut StyledBuffer , line : usize , col : usize ) {
2496
2494
let ( column, dots) = match self . theme {
2497
- OutputTheme :: Ascii => ( 0 , "..." ) ,
2498
- OutputTheme :: Unicode => ( col - 2 , "‡" ) ,
2495
+ DecorStyle :: Ascii => ( 0 , "..." ) ,
2496
+ DecorStyle :: Unicode => ( col - 2 , "‡" ) ,
2499
2497
} ;
2500
2498
buffer. puts ( line, column, dots, ElementStyle :: LineNumber ) ;
2501
2499
}
2502
2500
2503
2501
fn margin ( & self ) -> & ' static str {
2504
2502
match self . theme {
2505
- OutputTheme :: Ascii => "..." ,
2506
- OutputTheme :: Unicode => "..." ,
2503
+ DecorStyle :: Ascii => "..." ,
2504
+ DecorStyle :: Unicode => "..." ,
2507
2505
}
2508
2506
}
2509
2507
@@ -2533,7 +2531,7 @@ impl Renderer {
2533
2531
// ┗━━┛ < bottom_right
2534
2532
2535
2533
match ( self . theme , is_primary) {
2536
- ( OutputTheme :: Ascii , true ) => UnderlineParts {
2534
+ ( DecorStyle :: Ascii , true ) => UnderlineParts {
2537
2535
style : ElementStyle :: UnderlinePrimary ,
2538
2536
underline : '^' ,
2539
2537
label_start : '^' ,
@@ -2550,7 +2548,7 @@ impl Renderer {
2550
2548
multiline_end_same_line : '^' ,
2551
2549
multiline_bottom_right_with_text : '|' ,
2552
2550
} ,
2553
- ( OutputTheme :: Ascii , false ) => UnderlineParts {
2551
+ ( DecorStyle :: Ascii , false ) => UnderlineParts {
2554
2552
style : ElementStyle :: UnderlineSecondary ,
2555
2553
underline : '-' ,
2556
2554
label_start : '-' ,
@@ -2567,7 +2565,7 @@ impl Renderer {
2567
2565
multiline_end_same_line : '-' ,
2568
2566
multiline_bottom_right_with_text : '|' ,
2569
2567
} ,
2570
- ( OutputTheme :: Unicode , true ) => UnderlineParts {
2568
+ ( DecorStyle :: Unicode , true ) => UnderlineParts {
2571
2569
style : ElementStyle :: UnderlinePrimary ,
2572
2570
underline : '━' ,
2573
2571
label_start : '┯' ,
@@ -2584,7 +2582,7 @@ impl Renderer {
2584
2582
multiline_end_same_line : '┛' ,
2585
2583
multiline_bottom_right_with_text : '┥' ,
2586
2584
} ,
2587
- ( OutputTheme :: Unicode , false ) => UnderlineParts {
2585
+ ( DecorStyle :: Unicode , false ) => UnderlineParts {
2588
2586
style : ElementStyle :: UnderlineSecondary ,
2589
2587
underline : '─' ,
2590
2588
label_start : '┬' ,
@@ -2929,7 +2927,7 @@ struct UnderlineParts {
2929
2927
}
2930
2928
2931
2929
#[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
2932
- pub enum OutputTheme {
2930
+ pub enum DecorStyle {
2933
2931
Ascii ,
2934
2932
Unicode ,
2935
2933
}
0 commit comments