@@ -797,10 +797,9 @@ impl HumanEmitter {
797797 if let AnnotationType :: MultilineStart ( depth) = ann. annotation_type {
798798 if source_string. chars ( ) . take ( ann. start_col . display ) . all ( |c| c. is_whitespace ( ) ) {
799799 let uline = self . underline ( ann. is_primary ) ;
800- let style = uline. style ;
801800 let chr = uline. multiline_whole_line ;
802- annotations. push ( ( depth, style) ) ;
803- buffer_ops. push ( ( line_offset, width_offset + depth - 1 , chr, style) ) ;
801+ annotations. push ( ( depth, uline . style ) ) ;
802+ buffer_ops. push ( ( line_offset, width_offset + depth - 1 , chr, uline . style ) ) ;
804803 } else {
805804 short_start = false ;
806805 break ;
@@ -1044,26 +1043,24 @@ impl HumanEmitter {
10441043 // | _
10451044 for & ( pos, annotation) in & annotations_position {
10461045 let underline = self . underline ( annotation. is_primary ) ;
1047- let chr = underline. multiline_horizontal ;
1048- let style = underline. style ;
10491046 let pos = pos + 1 ;
10501047 match annotation. annotation_type {
10511048 AnnotationType :: MultilineStart ( depth) | AnnotationType :: MultilineEnd ( depth) => {
10521049 self . draw_range (
10531050 buffer,
1054- chr ,
1051+ underline . multiline_horizontal ,
10551052 line_offset + pos,
10561053 width_offset + depth,
10571054 ( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1058- style,
1055+ underline . style ,
10591056 ) ;
10601057 }
10611058 _ if self . teach => {
10621059 buffer. set_style_range (
10631060 line_offset,
10641061 ( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
10651062 ( code_offset + annotation. end_col . display ) . saturating_sub ( left) ,
1066- style,
1063+ underline . style ,
10671064 annotation. is_primary ,
10681065 ) ;
10691066 }
@@ -1084,13 +1081,6 @@ impl HumanEmitter {
10841081 // | |_
10851082 for & ( pos, annotation) in & annotations_position {
10861083 let underline = self . underline ( annotation. is_primary ) ;
1087- let style = underline. style ;
1088- let chr = underline. vertical_text_line ;
1089- let multiline = underline. multiline_vertical ;
1090- let start = underline. top_left ;
1091- let corner = underline. bottom_left ;
1092- let go_left = underline. bottom_right ;
1093- let end_with_label = underline. multiline_bottom_right_with_text ;
10941084 let pos = pos + 1 ;
10951085
10961086 if pos > 1 && ( annotation. has_label ( ) || annotation. takes_space ( ) ) {
@@ -1099,24 +1089,24 @@ impl HumanEmitter {
10991089 buffer. putc (
11001090 p,
11011091 ( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1102- multiline ,
1103- style,
1092+ underline . multiline_vertical ,
1093+ underline . style ,
11041094 ) ;
11051095 } else {
11061096 buffer. putc (
11071097 p,
11081098 ( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1109- chr ,
1110- style,
1099+ underline . vertical_text_line ,
1100+ underline . style ,
11111101 ) ;
11121102 }
11131103 }
11141104 if let AnnotationType :: MultilineStart ( _) = annotation. annotation_type {
11151105 buffer. putc (
11161106 line_offset + pos,
11171107 ( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1118- go_left ,
1119- style,
1108+ underline . bottom_right ,
1109+ underline . style ,
11201110 ) ;
11211111 }
11221112 if let AnnotationType :: MultilineEnd ( _) = annotation. annotation_type
@@ -1125,23 +1115,43 @@ impl HumanEmitter {
11251115 buffer. putc (
11261116 line_offset + pos,
11271117 ( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1128- end_with_label ,
1129- style,
1118+ underline . multiline_bottom_right_with_text ,
1119+ underline . style ,
11301120 ) ;
11311121 }
11321122 }
11331123 match annotation. annotation_type {
11341124 AnnotationType :: MultilineStart ( depth) => {
1135- buffer. putc ( line_offset + pos, width_offset + depth - 1 , start, style) ;
1125+ buffer. putc (
1126+ line_offset + pos,
1127+ width_offset + depth - 1 ,
1128+ underline. top_left ,
1129+ underline. style ,
1130+ ) ;
11361131 for p in line_offset + pos + 1 ..line_offset + line_len + 2 {
1137- buffer. putc ( p, width_offset + depth - 1 , multiline, style) ;
1132+ buffer. putc (
1133+ p,
1134+ width_offset + depth - 1 ,
1135+ underline. multiline_vertical ,
1136+ underline. style ,
1137+ ) ;
11381138 }
11391139 }
11401140 AnnotationType :: MultilineEnd ( depth) => {
11411141 for p in line_offset..line_offset + pos {
1142- buffer. putc ( p, width_offset + depth - 1 , multiline, style) ;
1142+ buffer. putc (
1143+ p,
1144+ width_offset + depth - 1 ,
1145+ underline. multiline_vertical ,
1146+ underline. style ,
1147+ ) ;
11431148 }
1144- buffer. putc ( line_offset + pos, width_offset + depth - 1 , corner, style) ;
1149+ buffer. putc (
1150+ line_offset + pos,
1151+ width_offset + depth - 1 ,
1152+ underline. bottom_left ,
1153+ underline. style ,
1154+ ) ;
11451155 }
11461156 _ => ( ) ,
11471157 }
@@ -1197,18 +1207,13 @@ impl HumanEmitter {
11971207 // | _^ test
11981208 for & ( pos, annotation) in & annotations_position {
11991209 let uline = self . underline ( annotation. is_primary ) ;
1200- let style = uline. style ;
1201- let underline = uline. underline ;
1202- let labeled_start = uline. label_start ;
1203- let flat_start = uline. top_right_flat ;
1204- let vertical_start = uline. multiline_start_down ;
12051210 for p in annotation. start_col . display ..annotation. end_col . display {
12061211 // The default span label underline.
12071212 buffer. putc (
12081213 line_offset + 1 ,
12091214 ( code_offset + p) . saturating_sub ( left) ,
1210- underline,
1211- style,
1215+ uline . underline ,
1216+ uline . style ,
12121217 ) ;
12131218 }
12141219
@@ -1222,8 +1227,8 @@ impl HumanEmitter {
12221227 buffer. putc (
12231228 line_offset + 1 ,
12241229 ( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1225- flat_start ,
1226- style,
1230+ uline . top_right_flat ,
1231+ uline . style ,
12271232 ) ;
12281233 } else if pos != 0
12291234 && matches ! (
@@ -1236,16 +1241,16 @@ impl HumanEmitter {
12361241 buffer. putc (
12371242 line_offset + 1 ,
12381243 ( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1239- vertical_start ,
1240- style,
1244+ uline . multiline_start_down ,
1245+ uline . style ,
12411246 ) ;
12421247 } else if pos != 0 && annotation. has_label ( ) {
12431248 // The beginning of a span label with an actual label, we'll point down.
12441249 buffer. putc (
12451250 line_offset + 1 ,
12461251 ( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1247- labeled_start ,
1248- style,
1252+ uline . label_start ,
1253+ uline . style ,
12491254 ) ;
12501255 }
12511256 }
0 commit comments