@@ -797,10 +797,9 @@ impl HumanEmitter {
797
797
if let AnnotationType :: MultilineStart ( depth) = ann. annotation_type {
798
798
if source_string. chars ( ) . take ( ann. start_col . display ) . all ( |c| c. is_whitespace ( ) ) {
799
799
let uline = self . underline ( ann. is_primary ) ;
800
- let style = uline. style ;
801
800
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 ) ) ;
804
803
} else {
805
804
short_start = false ;
806
805
break ;
@@ -1019,26 +1018,24 @@ impl HumanEmitter {
1019
1018
// | _
1020
1019
for & ( pos, annotation) in & annotations_position {
1021
1020
let underline = self . underline ( annotation. is_primary ) ;
1022
- let chr = underline. multiline_horizontal ;
1023
- let style = underline. style ;
1024
1021
let pos = pos + 1 ;
1025
1022
match annotation. annotation_type {
1026
1023
AnnotationType :: MultilineStart ( depth) | AnnotationType :: MultilineEnd ( depth) => {
1027
1024
self . draw_range (
1028
1025
buffer,
1029
- chr ,
1026
+ underline . multiline_horizontal ,
1030
1027
line_offset + pos,
1031
1028
width_offset + depth,
1032
1029
( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1033
- style,
1030
+ underline . style ,
1034
1031
) ;
1035
1032
}
1036
1033
_ if self . teach => {
1037
1034
buffer. set_style_range (
1038
1035
line_offset,
1039
1036
( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1040
1037
( code_offset + annotation. end_col . display ) . saturating_sub ( left) ,
1041
- style,
1038
+ underline . style ,
1042
1039
annotation. is_primary ,
1043
1040
) ;
1044
1041
}
@@ -1059,13 +1056,6 @@ impl HumanEmitter {
1059
1056
// | |_
1060
1057
for & ( pos, annotation) in & annotations_position {
1061
1058
let underline = self . underline ( annotation. is_primary ) ;
1062
- let style = underline. style ;
1063
- let chr = underline. vertical_text_line ;
1064
- let multiline = underline. multiline_vertical ;
1065
- let start = underline. top_left ;
1066
- let corner = underline. bottom_left ;
1067
- let go_left = underline. bottom_right ;
1068
- let end_with_label = underline. multiline_bottom_right_with_text ;
1069
1059
let pos = pos + 1 ;
1070
1060
1071
1061
if pos > 1 && ( annotation. has_label ( ) || annotation. takes_space ( ) ) {
@@ -1074,24 +1064,24 @@ impl HumanEmitter {
1074
1064
buffer. putc (
1075
1065
p,
1076
1066
( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1077
- multiline ,
1078
- style,
1067
+ underline . multiline_vertical ,
1068
+ underline . style ,
1079
1069
) ;
1080
1070
} else {
1081
1071
buffer. putc (
1082
1072
p,
1083
1073
( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1084
- chr ,
1085
- style,
1074
+ underline . vertical_text_line ,
1075
+ underline . style ,
1086
1076
) ;
1087
1077
}
1088
1078
}
1089
1079
if let AnnotationType :: MultilineStart ( _) = annotation. annotation_type {
1090
1080
buffer. putc (
1091
1081
line_offset + pos,
1092
1082
( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1093
- go_left ,
1094
- style,
1083
+ underline . bottom_right ,
1084
+ underline . style ,
1095
1085
) ;
1096
1086
}
1097
1087
if let AnnotationType :: MultilineEnd ( _) = annotation. annotation_type
@@ -1100,23 +1090,43 @@ impl HumanEmitter {
1100
1090
buffer. putc (
1101
1091
line_offset + pos,
1102
1092
( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1103
- end_with_label ,
1104
- style,
1093
+ underline . multiline_bottom_right_with_text ,
1094
+ underline . style ,
1105
1095
) ;
1106
1096
}
1107
1097
}
1108
1098
match annotation. annotation_type {
1109
1099
AnnotationType :: MultilineStart ( depth) => {
1110
- buffer. putc ( line_offset + pos, width_offset + depth - 1 , start, style) ;
1100
+ buffer. putc (
1101
+ line_offset + pos,
1102
+ width_offset + depth - 1 ,
1103
+ underline. top_left ,
1104
+ underline. style ,
1105
+ ) ;
1111
1106
for p in line_offset + pos + 1 ..line_offset + line_len + 2 {
1112
- buffer. putc ( p, width_offset + depth - 1 , multiline, style) ;
1107
+ buffer. putc (
1108
+ p,
1109
+ width_offset + depth - 1 ,
1110
+ underline. multiline_vertical ,
1111
+ underline. style ,
1112
+ ) ;
1113
1113
}
1114
1114
}
1115
1115
AnnotationType :: MultilineEnd ( depth) => {
1116
1116
for p in line_offset..line_offset + pos {
1117
- buffer. putc ( p, width_offset + depth - 1 , multiline, style) ;
1117
+ buffer. putc (
1118
+ p,
1119
+ width_offset + depth - 1 ,
1120
+ underline. multiline_vertical ,
1121
+ underline. style ,
1122
+ ) ;
1118
1123
}
1119
- buffer. putc ( line_offset + pos, width_offset + depth - 1 , corner, style) ;
1124
+ buffer. putc (
1125
+ line_offset + pos,
1126
+ width_offset + depth - 1 ,
1127
+ underline. bottom_left ,
1128
+ underline. style ,
1129
+ ) ;
1120
1130
}
1121
1131
_ => ( ) ,
1122
1132
}
@@ -1172,18 +1182,13 @@ impl HumanEmitter {
1172
1182
// | _^ test
1173
1183
for & ( pos, annotation) in & annotations_position {
1174
1184
let uline = self . underline ( annotation. is_primary ) ;
1175
- let style = uline. style ;
1176
- let underline = uline. underline ;
1177
- let labeled_start = uline. label_start ;
1178
- let flat_start = uline. top_right_flat ;
1179
- let vertical_start = uline. multiline_start_down ;
1180
1185
for p in annotation. start_col . display ..annotation. end_col . display {
1181
1186
// The default span label underline.
1182
1187
buffer. putc (
1183
1188
line_offset + 1 ,
1184
1189
( code_offset + p) . saturating_sub ( left) ,
1185
- underline,
1186
- style,
1190
+ uline . underline ,
1191
+ uline . style ,
1187
1192
) ;
1188
1193
}
1189
1194
@@ -1197,8 +1202,8 @@ impl HumanEmitter {
1197
1202
buffer. putc (
1198
1203
line_offset + 1 ,
1199
1204
( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1200
- flat_start ,
1201
- style,
1205
+ uline . top_right_flat ,
1206
+ uline . style ,
1202
1207
) ;
1203
1208
} else if pos != 0
1204
1209
&& matches ! (
@@ -1211,16 +1216,16 @@ impl HumanEmitter {
1211
1216
buffer. putc (
1212
1217
line_offset + 1 ,
1213
1218
( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1214
- vertical_start ,
1215
- style,
1219
+ uline . multiline_start_down ,
1220
+ uline . style ,
1216
1221
) ;
1217
1222
} else if pos != 0 && annotation. has_label ( ) {
1218
1223
// The beginning of a span label with an actual label, we'll point down.
1219
1224
buffer. putc (
1220
1225
line_offset + 1 ,
1221
1226
( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1222
- labeled_start ,
1223
- style,
1227
+ uline . label_start ,
1228
+ uline . style ,
1224
1229
) ;
1225
1230
}
1226
1231
}
0 commit comments