@@ -18,6 +18,7 @@ use std::convert::TryInto;
18
18
use tui:: {
19
19
backend:: Backend ,
20
20
layout:: { Constraint , Rect } ,
21
+ symbols:: line:: VERTICAL ,
21
22
text:: Span ,
22
23
widgets:: { Block , Borders , Cell , Clear , Row , Table , TableState } ,
23
24
Frame ,
@@ -37,10 +38,12 @@ pub struct BlameFileComponent {
37
38
static COMMIT_ID : & str = "HEAD" ;
38
39
static NO_COMMIT_ID : & str = "0000000" ;
39
40
static NO_AUTHOR : & str = "<no author>" ;
40
- static AUTHOR_WIDTH : usize = 20 ;
41
+ static MIN_AUTHOR_WIDTH : usize = 3 ;
42
+ static MAX_AUTHOR_WIDTH : usize = 20 ;
41
43
42
44
fn get_author_width ( width : usize ) -> usize {
43
- ( width. saturating_sub ( 19 ) / 3 ) . max ( 3 ) . min ( AUTHOR_WIDTH )
45
+ ( width. saturating_sub ( 19 ) / 3 )
46
+ . clamp ( MIN_AUTHOR_WIDTH , MAX_AUTHOR_WIDTH )
44
47
}
45
48
46
49
const fn number_of_digits ( number : usize ) -> usize {
@@ -279,10 +282,10 @@ impl BlameFileComponent {
279
282
280
283
let line_number_width = self . get_line_number_width ( ) ;
281
284
cells. push (
282
- // U+2502 is BOX DRAWINGS LIGHT VERTICAL.
283
285
Cell :: from ( format ! (
284
- "{:>line_number_width$}\u{2502 } " ,
286
+ "{:>line_number_width$}{ }" ,
285
287
line_number,
288
+ VERTICAL ,
286
289
line_number_width = line_number_width,
287
290
) )
288
291
. style ( self . theme . text ( true , false ) ) ,
@@ -312,7 +315,7 @@ impl BlameFileComponent {
312
315
let author = format ! (
313
316
"{:author_width$}" ,
314
317
truncated_author,
315
- author_width = AUTHOR_WIDTH
318
+ author_width = MAX_AUTHOR_WIDTH
316
319
) ;
317
320
let time = blame_hunk. map_or_else (
318
321
|| "" . into ( ) ,
0 commit comments