mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builder: fix a bug in error_context_lines
This commit is contained in:
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 {
|
||||
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()
|
||||
for idx, eline in lines {
|
||||
if eline.contains(keyword) {
|
||||
lines[idx] = lines[idx].replace(keyword, khighlight)
|
||||
if eline_idx == 0 {
|
||||
if eline_idx == -1 {
|
||||
eline_idx = idx
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user