builder: fix a bug in error_context_lines
parent
00a0c1886e
commit
feadf777c3
|
@ -941,12 +941,12 @@ fn missing_compiler_info() string {
|
||||||
|
|
||||||
fn error_context_lines(text string, keyword string, before int, after int) []string {
|
fn error_context_lines(text string, keyword string, before int, after int) []string {
|
||||||
khighlight := if term.can_show_color_on_stdout() { term.red(keyword) } else { keyword }
|
khighlight := if term.can_show_color_on_stdout() { term.red(keyword) } else { keyword }
|
||||||
mut eline_idx := 0
|
mut eline_idx := -1
|
||||||
mut lines := text.split_into_lines()
|
mut lines := text.split_into_lines()
|
||||||
for idx, eline in lines {
|
for idx, eline in lines {
|
||||||
if eline.contains(keyword) {
|
if eline.contains(keyword) {
|
||||||
lines[idx] = lines[idx].replace(keyword, khighlight)
|
lines[idx] = lines[idx].replace(keyword, khighlight)
|
||||||
if eline_idx == 0 {
|
if eline_idx == -1 {
|
||||||
eline_idx = idx
|
eline_idx = idx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue