From feadf777c378e233a47d10379ecd3b7fc6d71f35 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 4 Jan 2022 10:59:39 +0200 Subject: [PATCH] builder: fix a bug in error_context_lines --- vlib/v/builder/cc.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vlib/v/builder/cc.v b/vlib/v/builder/cc.v index ade2374616..3306988d34 100644 --- a/vlib/v/builder/cc.v +++ b/vlib/v/builder/cc.v @@ -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 } }