@@ -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 ;
@@ -1044,26 +1043,24 @@ impl HumanEmitter {
1044
1043
// | _
1045
1044
for & ( pos, annotation) in & annotations_position {
1046
1045
let underline = self . underline ( annotation. is_primary ) ;
1047
- let chr = underline. multiline_horizontal ;
1048
- let style = underline. style ;
1049
1046
let pos = pos + 1 ;
1050
1047
match annotation. annotation_type {
1051
1048
AnnotationType :: MultilineStart ( depth) | AnnotationType :: MultilineEnd ( depth) => {
1052
1049
self . draw_range (
1053
1050
buffer,
1054
- chr ,
1051
+ underline . multiline_horizontal ,
1055
1052
line_offset + pos,
1056
1053
width_offset + depth,
1057
1054
( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1058
- style,
1055
+ underline . style ,
1059
1056
) ;
1060
1057
}
1061
1058
_ if self . teach => {
1062
1059
buffer. set_style_range (
1063
1060
line_offset,
1064
1061
( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1065
1062
( code_offset + annotation. end_col . display ) . saturating_sub ( left) ,
1066
- style,
1063
+ underline . style ,
1067
1064
annotation. is_primary ,
1068
1065
) ;
1069
1066
}
@@ -1084,13 +1081,6 @@ impl HumanEmitter {
1084
1081
// | |_
1085
1082
for & ( pos, annotation) in & annotations_position {
1086
1083
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 ;
1094
1084
let pos = pos + 1 ;
1095
1085
1096
1086
if pos > 1 && ( annotation. has_label ( ) || annotation. takes_space ( ) ) {
@@ -1099,24 +1089,24 @@ impl HumanEmitter {
1099
1089
buffer. putc (
1100
1090
p,
1101
1091
( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1102
- multiline ,
1103
- style,
1092
+ underline . multiline_vertical ,
1093
+ underline . style ,
1104
1094
) ;
1105
1095
} else {
1106
1096
buffer. putc (
1107
1097
p,
1108
1098
( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1109
- chr ,
1110
- style,
1099
+ underline . vertical_text_line ,
1100
+ underline . style ,
1111
1101
) ;
1112
1102
}
1113
1103
}
1114
1104
if let AnnotationType :: MultilineStart ( _) = annotation. annotation_type {
1115
1105
buffer. putc (
1116
1106
line_offset + pos,
1117
1107
( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1118
- go_left ,
1119
- style,
1108
+ underline . bottom_right ,
1109
+ underline . style ,
1120
1110
) ;
1121
1111
}
1122
1112
if let AnnotationType :: MultilineEnd ( _) = annotation. annotation_type
@@ -1125,23 +1115,43 @@ impl HumanEmitter {
1125
1115
buffer. putc (
1126
1116
line_offset + pos,
1127
1117
( 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 ,
1130
1120
) ;
1131
1121
}
1132
1122
}
1133
1123
match annotation. annotation_type {
1134
1124
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
+ ) ;
1136
1131
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
+ ) ;
1138
1138
}
1139
1139
}
1140
1140
AnnotationType :: MultilineEnd ( depth) => {
1141
1141
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
+ ) ;
1143
1148
}
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
+ ) ;
1145
1155
}
1146
1156
_ => ( ) ,
1147
1157
}
@@ -1197,18 +1207,13 @@ impl HumanEmitter {
1197
1207
// | _^ test
1198
1208
for & ( pos, annotation) in & annotations_position {
1199
1209
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 ;
1205
1210
for p in annotation. start_col . display ..annotation. end_col . display {
1206
1211
// The default span label underline.
1207
1212
buffer. putc (
1208
1213
line_offset + 1 ,
1209
1214
( code_offset + p) . saturating_sub ( left) ,
1210
- underline,
1211
- style,
1215
+ uline . underline ,
1216
+ uline . style ,
1212
1217
) ;
1213
1218
}
1214
1219
@@ -1222,8 +1227,8 @@ impl HumanEmitter {
1222
1227
buffer. putc (
1223
1228
line_offset + 1 ,
1224
1229
( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1225
- flat_start ,
1226
- style,
1230
+ uline . top_right_flat ,
1231
+ uline . style ,
1227
1232
) ;
1228
1233
} else if pos != 0
1229
1234
&& matches ! (
@@ -1236,16 +1241,16 @@ impl HumanEmitter {
1236
1241
buffer. putc (
1237
1242
line_offset + 1 ,
1238
1243
( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1239
- vertical_start ,
1240
- style,
1244
+ uline . multiline_start_down ,
1245
+ uline . style ,
1241
1246
) ;
1242
1247
} else if pos != 0 && annotation. has_label ( ) {
1243
1248
// The beginning of a span label with an actual label, we'll point down.
1244
1249
buffer. putc (
1245
1250
line_offset + 1 ,
1246
1251
( code_offset + annotation. start_col . display ) . saturating_sub ( left) ,
1247
- labeled_start ,
1248
- style,
1252
+ uline . label_start ,
1253
+ uline . style ,
1249
1254
) ;
1250
1255
}
1251
1256
}
0 commit comments