File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,9 @@ impl Display for TomlError {
98
98
let col_num = column + 1 ;
99
99
let gutter = line_num. to_string ( ) . len ( ) ;
100
100
let content = raw. split ( '\n' ) . nth ( line) . expect ( "valid line number" ) ;
101
+ let highlight_len = span. end - span. start ;
102
+ // Allow highlight to go one past the line
103
+ let highlight_len = highlight_len. min ( content. len ( ) . saturating_sub ( column) ) ;
101
104
102
105
writeln ! (
103
106
f,
@@ -125,7 +128,7 @@ impl Display for TomlError {
125
128
// The span will be empty at eof, so we need to make sure we always print at least
126
129
// one `^`
127
130
write ! ( f, "^" ) ?;
128
- for _ in ( span . start + 1 ) .. ( span . end . min ( span . start + content . len ( ) - column ) ) {
131
+ for _ in 1 ..highlight_len {
129
132
write ! ( f, "^" ) ?;
130
133
}
131
134
writeln ! ( f) ?;
You can’t perform that action at this time.
0 commit comments